AVL Tree
A search tree that rotates itself back into balance whenever two sides differ in height by two.
Decision · step 6 of 41AVL Tree: A longer mixed sequence
At 50: left height 1, right height 0, balance 1. Within one, so it stays.
What you will see
Balance factors on nodes; an imbalance triggers a visible rotation.
Cost
| search | O(log n) |
|---|---|
| insert | O(log n) |
| delete | O(log n) |
| Space | O(n) |
How you work with it here
play it through, step one change at a time, scrub to any step, run it on your own input, try operations in any order.
Screen readers: Each element is an accessibility element with position, value and state; structural changes are announced per step.
Reduced motion: Elements appear at their destination with a crossfade; no travel longer than the element's own size.
Before this
Taught by the same lesson
AVL Tree covers these too, in the same run.