AI engineering glossary · Data structures algorithms

What is AVL tree?

AVL tree (also called self-balancing tree): A self-balancing binary search tree that keeps the heights of the two subtrees of every node within 1 of each other, restoring balance with rotations after inserts and deletes. This guarantees O(log n) search, insert and delete.

Level: advancedTopic: Data structures algorithms

AVL tree: an example

Inserting 1, 2, 3, 4, 5 in order into a plain search tree gives a chain of height 5. An AVL tree rotates as it goes and stays about 3 levels tall.

Related terms

More Data structures algorithms terms

Where you learn it

AVL tree is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.