close

Вход

Забыли?

вход по аккаунту

код для вставкиСкачать
Self-Adjusting Trees
1
Motivation
• We would like frequently searched nodes of a BST to
be close to the top of the tree
– On searching, change node position analogous to the
manner in which we changed it in a self-organizing linked list
• Move-up
– Perform a rotation so that the node searched moves up one
level
• Move-to-root
– Repeat rotations until node searched becomes the root
2
Example
13
20
5
3
13
Move-up
8
8
5
18
18
3
Search for 8
Move-to-root
20
8
5
13
3
20
18
3
1/--страниц
Пожаловаться на содержимое документа