AVL Self-Balancing Tree & Rotations
An AVL tree enforces strict height balance by keeping every node balance factor within {-1, 0, +1}, performing O(1) LL, RR, LR, or RL rotations so search, insert, and delete stay O(log n).
Technical Reference & Equations
- Node Balance Factor Invariant:
\mathrm{BF}(v) = h(v_{\text{left}}) - h(v_{\text{right}}) \in \{-1, 0, +1\}(Triggers LL/LR rebalancing when BF > +1, and RR/RL rebalancing when BF < -1.) - Fibonacci Minimum Nodes & Height Bound:
h < 1.44 \log_2(n + 2) - 0.328(Strict logarithmic worst-case tree height for n stored keys.) - Worst-Case Time Complexity:
T_{\text{search}} = T_{\text{insert}} = T_{\text{delete}} = O(\log n)(Insert requires at most 1 single or double rotation; delete requires O(log n) rotations.)
View full Data Structures & Algorithms Formula Sheet | Constants Table
Related Data Structures Calculators
- Binary Search Tree Visualizer: Insert, delete, and search nodes on a live binary search tree with in-order, pre-order, and post-order traversals.
- B+ Tree Index & Range Scan Visualizer: Insert keys into order m=3/4/5 B+ Trees to inspect internal/leaf splits, linked leaf sibling pointers, and SQL range query disk I/O cost.
- Binary Heap & Priority Queue: Synchronize Min-Heap and Max-Heap binary trees with their 0-indexed backing arrays, Sift-Up/Sift-Down paths, Extract-Root, and Floyd O(n) Build-Heap.
- Sorting Algorithm Visualizer: Step through Quick, Merge, Insertion, Selection, and Bubble Sort with comparison and swap counters.
- Big-O Growth Comparator: Compare asymptotic complexity curves and estimated wall-clock runtimes across input sizes.
- Hash Table & Collision Resolution Simulator: Compare Linear Probing, Quadratic Probing, Double Hashing, and Separate Chaining with live load factor, probe sequences, and clustering metrics.