AVL Trees

What is an AVL Tree?

An AVL tree is a self-balancing binary search tree that stores the heights of each node's left and right subtrees to maintain efficiency of searching, inserting, and deleting operations.

Why AVL Trees are Used

AVL trees are used because they automatically rebalance themselves after updates. This helps keep operations quick by making it so the tree cannot be too skewed in one direction.

How are AVL Trees Balanced?

The height of a node's left subtree minus the height of its right subtree is called the Balance Factor of a node. If the absolute value of a nodes' balance factor is greater than or equal to 2, it is considered unbalanced, and a rotation must occur to fix the unbalance.

Important AVL Tree Rotation Cases around unbalanced node

AVL Tree Diagram with Insertions

Learn more about AVL trees at Wikipedia: AVL Trees Wikipedia