Professional Documents
Culture Documents
2)
AVL trees are
AVL Trees
4
balanced. 44
2 3
An AVL Tree is a 17 78
v
6
binary search tree 1 2 1
32 50 88
3 8 such that for every
z 1 1
4 internal node v of T, 48 62
the heights of the
children of v can
differ by at most 1. An example of an AVL tree where the
heights are shown next to the nodes:
© 2004 Goodrich, Tamassia AVL Trees 1 © 2004 Goodrich, Tamassia AVL Trees 2
n(2) 3
4 n(1)
Restructuring Restructuring
(as Single Rotations) (as Double Rotations)
Single Rotations: double rotations:
32 50 78 50 78 44 78
w 17 62 b=y
48 54 88 48 54 88 17 50 88
50 78 c=x
48 54
48 54 88
before deletion of 32 after deletion
© 2004 Goodrich, Tamassia AVL Trees 9 © 2004 Goodrich, Tamassia AVL Trees 10