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