Make your own free website on

Imbalance: one tree is tall, the other short.

To rebalance: shorten the tall side and/or lengthen the short side. Perform a rotation:

Join rebalanced subtree back in:
Insert -1

What to do with 1's right subtree?

Answer: it becomes the left subtree of the node that rotated down.