AVL Tree
AVL tree is a self-balancing binary search tree named after its inventors, Georgy Adelson-Velsky and Evgenii Landis, who introduced it in 1962. It was the first data structure to guarantee O(log n) time for insertion, deletion, and lookup by maintaining a balance invariant: for every node, the heights of its left and right subtrees differ by at most one. When this invariant is violated by an insertion or deletion, the tree rebalances itself through a sequence of rotations — local restructuring operations that restore balance while maintaining the binary search tree ordering property.
The AVL tree guarantees that lookup, insertion, and deletion are logarithmic in the worst case, a property that unbalanced binary search trees only achieve on average. This worst-case guarantee makes AVL trees suitable for real-time systems and performance-critical applications where predictable latency matters more than average-case efficiency. The cost is more frequent rebalancing compared to red-black trees, which enforce a weaker balance condition.
Despite its historical significance as the first self-balancing tree, the AVL tree has been largely superseded in practice by red-black trees and B-trees, which offer similar guarantees with lower rebalancing overhead. Yet AVL trees remain theoretically important: they demonstrate that balance can be maintained with purely local operations, and they serve as the pedagogical foundation for understanding the broader family of self-balancing binary search trees.
The AVL tree is a monument to an era when computer scientists believed that worst-case guarantees were the hallmark of good engineering. In the modern landscape of amortized analysis, probabilistic data structures, and approximate methods, the AVL tree's rigid determinism feels almost quaint — a reminder that the field's aesthetic has shifted from ironclad certainty to graceful degradation.