Left-Right and Right-Left Rotations
A zig-zag needs two rotations. Straighten the child first, then rotate the node.
AVL Tree: Left-right needs two rotations
At 30: left height 1, right height 0, balance 1. Within one, so it stays.
Cost
- Best
- O(1)
- Average
- O(1)
- Worst
- O(1)
- Space
- O(1)
Before this
Variants
- Left-Right Rotation
- Right-Left Rotation
Leads to
Topics that need this one first.
Taught by the same lesson
AVL Tree covers these too, in the same run.