AVL tree 2026-11-05
An AVL tree is a binary search tree in which the left and right subtree heights differ by at most one at every vertex. The ordering invariant supports directed search; the extra height condition prevents the long chains that make an unbalanced binary search tree slow. Tree rotations repair the shape while preserving key order.[ref]
Balanced binary trees in Cornell CS 2112. AVL Trees and Rotations
Inserting keys
3,2,1 into an ordinary binary search tree produces a chain. A right tree rotation at three makes two the root with children one and three. For a height proof, count edges and set the empty-tree height to . The minimum vertex count satisfiesThis Fibonacci sequence growth gives height of a binary tree , hence logarithmic worst-case search, insertion and deletion time complexity. Deletion may require repairs at several ancestors. Cecilia R. Aragon 2026-11-05
Cecilia R. Aragon coauthored the randomized search-tree construction with Raimund Seidel. Their treap combines binary search tree order on keys with heap order on random priorities. A key set and distinct priorities determine the tree; independent random priorities give expected logarithmic search and update costs. The analysis separates expected cost from the possibly linear height of a particular realization.[ref]
The construction makes balancing probabilistic without storing the explicit balance conditions used by AVL trees. Operations that split or join a tree preserve the two orderings, making the idea useful for both ordered dictionaries and sequence data structures.