AVL Algorithm Revisited
Recursive
1. Search downward for
spot
2. Insert node
3. Unwind stack,
correcting heights
a. If imbalance #1,
single rotate
b. If imbalance #2,
double rotate
Iterative
1. Search downward for
spot, stacking
parent nodes
2. Insert node
3. Unwind stack,
correcting heights
a. If imbalance #1,
single rotate and
exit
b. If imbalance #2,
double rotate and
exit
Previous slide
Next slide
Back to first slide
View graphic version