Structural Rotation: Exercise

  • Trace the balancing operations of an AVL tree.

Exercise Starting from an empty BST, perform the following operations in order. Apply structural rotations, if needed, to keep the BST balanced.

insert(15)
insert(20)
insert(24)
insert(10)
insert(13)
insert(7)
insert(30)
insert(36)
insert(25)
remove(24)
remove(20)
Solution

Visit this interactive visualizer and carry out the operations.

The final BST should look like this: