AVL TREES

What is an AVL tree?

Balanced vs Unbalanced tree example

Adelson-Velsky and Landis (AVL) Trees are self-balancing Binary Search Trees which use rotations to maintain balance.

Balance is tracked using a balance factor.

How do we calculate the balance factor?

At a node v, the balance factor is the height of the left subtree minus the height of the right subtree.

A node v is balanced if |bf (v)| < 2


To read more in detail about AVL trees check here.