Insert 2 &
complete tree
6
4
9
8
1
5
5
2
8
6
9
1
4
h-1
h-2
h
0
0
height=2 BF=1-0=1
0
6
4
9
1
5
1
Tree A (AVL)
Tree B (AVL)
1
0
2
0
6
4
9
1
5
1
0
7
0
7
balance factor
1-(-1) = 2
-1
Tree A (AVL)
Tree B (not AVL)
The rebalancing is performed through four
separate rotation algorithms.
Insertions in AVL Trees
h
h
h
AVL Insertion: Outside Case
h
h+1
h
Outside Case Completed
AVL property has been restored!
h
h+1
h
j
k
X
Y
Z
AVL Insertion: Inside Case
Does “right rotation”
restore balance?
h
h+1
h
AVL Insertion: Inside Case
h
h+1
h
h
h+1
h
AVL Insertion: Inside Case
h
h+1
h
h or h-1
h
h
h or h-1
X
Y
Z
n
You also need to modify the heights or balance factors of n and p
Insert
X
n
V
W
Z
Pros and Cons of AVL Trees
X
n
V
W
Z
Если не удалось найти и скачать презентацию, Вы можете заказать его на нашем сайте. Мы постараемся найти нужный Вам материал и отправим по электронной почте. Не стесняйтесь обращаться к нам, если у вас возникли вопросы или пожелания:
Email: Нажмите что бы посмотреть