AVL Trees

Insert, search, delete, and rotation demos with manual step-through control

AVL Trees

Pick a mode to walk through the AVL tree manually. Each demo starts at step 0 and advances only when you press Next Step.

Explanation

Insert, search, and delete follow the binary search tree path first. After a mutation, the AVL helpers rebalance the affected ancestors so the height difference stays within one.

The LL, RR, LR, and RL modes isolate the four rotation cases. The state cards show the active node, the first imbalance node, the rotation label, and the balance factor when the helper exposes it.

Complexity

Insert
Time:O(log n)
Space:O(log n)
Search
Time:O(log n)
Space:O(log n)
Delete
Time:O(log n)
Space:O(log n)
LL Rotation
Time:O(1)
Space:O(1)
RR Rotation
Time:O(1)
Space:O(1)
LR Rotation
Time:O(1)
Space:O(1)
RL Rotation
Time:O(1)
Space:O(1)