An AVL tree requires that for every node, the children’s heights differ by at most:
AVL Trees
The AVL height-balance property, why it keeps height O(log n), insertion with trinode restructuring (single and double rotations), removal, and performance.
How to read this page
Every original slide is shown unchanged. Yellow marks on a slide point to a numbered note: hover or tap a mark to jump to its note, and hover a note to see its marks. Questions tagged Past exam appeared on a real paper; Prediction questions are likely angles, not confirmed. Pick an answer to each question: a wrong pick tells you why it is wrong, so you can try again.
All 27 slides
- 1 Presentation for use with the textbook Data Structures and Algorithms in Java, 6 th edition, by M. T. Goodrich, R. Tamassia, and M. H. Goldwasser, Wiley, 2014
- 2 to k
- 3 Slide 3
- 4 Slide 4
- 5 the ofthe
- 6 Beastcasueoctogn
- 7 Iiii
- 8 Slide 8
- 9 Trinode Restructuring
- 10 Insertion Example, continued
- 11 Restructuring (as Single Rotations)
- 12 Slide 12
- 13 some 2
- 14 www.n.si
- 15 Restructuring (as Double Rotations)
- 16 Slide 16
- 17 Removal
- 18 504 3
- 19 Slide 19
- 20 Rebalancing after a Removal
- 21 AVL Tree Performance
- 22 Java Implementation
- 23 Java Implementation, 2
- 24 Java Implementation, 3
- 25 Slide 25
- 26 Slide 26
- 27 aol.w.im oxides
to k
Exam angle
Trinode Restructuring
Notes
Trinode restructuring: take the unbalanced node z, its taller child y and grandchild x; make the middle one the root of the subtree.
Restructuring (as Single Rotations)
Notes
Single rotation when x, y, z are in a straight line (LL or RR).
Restructuring (as Double Rotations)
Notes
Double rotation when they zig-zag (LR or RL).
Exam angle
An imbalance caused by inserting into the right subtree of a node’s left child needs a:
AVL Tree Performance
Exam angle
Worst-case search in an AVL tree with n nodes: