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.
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
- B-tree
- Backtracking
- Base case
- Bellman-Ford algorithm
- Big-O notation
- Big-Omega notation
- Big-Theta notation
- Binary search
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.