Back to All Algorithms
AVL Tree
Category: Tree / Graph | Time: O(log n) | Space: O(log n)
Visualization
Visual representation of the data structure
Enter tree data to start visualization.
About AVL Tree

A self-balancing binary search tree. It was the first such data structure to be invented. In an AVL tree, the heights of the two child subtrees of any node differ by at most one; if at any time they differ by more than one, rebalancing is done to restore this property.

Code Editor
The code is for reference. Editing it won't affect the visualization.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Frequently Asked Questions
About AVL Tree