Right Rotation
The left child comes up and the old node drops to its right.
AVL Tree: Left-left needs a right rotation
20 is now the root of this subtree, with 30 beneath it. Heights differ by at most one again, and nothing above needs checking: the subtree is exactly as tall as before the insert.
Cost
- Best
- O(1)
- Average
- O(1)
- Worst
- O(1)
- Space
- O(1)
Before this
Related
Leads to
Topics that need this one first.
Taught by the same lesson
AVL Tree covers these too, in the same run.