AVL Tree Overview | Generated by AI

Home 2025.10

What is an AVL Tree?

An AVL tree is a type of self-balancing binary search tree (BST), invented in 1962 by Georgy Adelson-Velsky and Evgenii Landis (hence the name). Like any BST, it stores data in a sorted manner: all nodes in the left subtree are smaller than the parent, and all in the right are larger. The key feature is that it automatically adjusts its structure after insertions or deletions to stay balanced.

How Does It Work?

Example: Inserting nodes in sorted order into a plain BST would make it a linked list (unbalanced). In an AVL tree, rotations keep it roughly height-balanced, like this simplified before/after:

Unbalanced (after inserts: 1,2,3):
    2
   /
  1
 /
3  (wait, actually skewed right: 1->2->3)

After rotation:
  2
 / \
1   3

Why Is It Special?

In short, AVL trees are “special” for their rigorous self-balancing, turning potentially chaotic BSTs into reliable, logarithmic performers.

For more details: AVL Tree on Wikipedia


Back

x-ai/grok-4-fast

Donate