Algorithms

AVL tree

A binary search tree that keeps itself balanced: after every change it checks each node's balance factor and, if it goes past 1, fixes it with rotations.

Example

Inserting 1,000 numbers in order, a regular search tree ends up with height 999; an AVL, with a height of about 10.

Test yourself: AVL tree

AVL trees

What problem does an AVL tree solve?

Lessons that use it

More algorithms terms

All terms →

Arki, the beaver mascot

Your next interview starts with 5 minutes today.

Free on iOS and Android. Start from zero, no account needed.