previous | start | next

RotateLeft (Before Insertion)

      
                 100 [h=3]
                /   \
               /     \
      [h=1]   A      150 [h=2]
                    /   \
                   /     \
            [h=1] B       C [h=1]
   

Inserting 190 will make subtree C at 175 have height 2 with children of height 0 and 1
(175 will still be balanced).

This makes the subtree at 150 height 3 with children of height 1 and 2
(150 will still be balanced)

But this makes the subtree at 100 unbalanced. Its children will have heights 1 and 3
(100 will be unbalanced)!



previous | start | next