Tree Sandbox Labs
BST & AVL Self-Balancing Tree Sandbox
Insert, search, or delete nodes and trace balance factors and rotations step-by-step.
Algorithm:
Animate Traversals
AVL Rotation Tutorials
Left-Left (LL) Single RotationInserting 10 into a left-skewed path (30 -> 20) triggers a single Right Rotation around node 30 to restore balance.
Right-Right (RR) Single RotationInserting 30 into a right-skewed path (10 -> 20) triggers a single Left Rotation around node 10 to restore balance.
Left-Right (LR) Double RotationInserting 20 into the right child of left child (30 -> 10 -> 20) requires a Left Rotation around 10, followed by a Right Rotation around 30.
Right-Left (RL) Double RotationInserting 20 into the left child of right child (10 -> 30 -> 20) requires a Right Rotation around 30, followed by a Left Rotation around 10.