Download presentation

Presentation is loading. Please wait.

Published byKyla Willcox Modified over 2 years ago

1
Algoritmo de Inserção Raghu Ramakrishman (by Gustavo Tadao) Árvore B

2
1020 30 40 7 Lista de valores Root 1 Folhas 1 2 Próxima Página 3 8 9 40 43 46 47 3235 37 39 21 24 25 28 13 15 17 191 Insert(root, 7, newchildentry)(is non-leaf)Find i such that Ki <= entry’s keyvalue < Ki+1Insert(Pi, 7, newchildentry )(is leaf)(has no space)Split LNewchildentry = & 1 3 7 8 9 Set sibling poiters in L and L2Return (newchildentry = & )

3
Fim 1020 30 40 Root 4043464732353739 2124252813151719 1 3 7 89 (has no space)Split NNewchildentry = & N is rootCreate new node with (pointer to N, ) 2030 20 710 Make the tree’s root-node pointer to the new node;return Root 4030 40

4
Algoritmo de Remoção Raghu Ramakrishman

5
Delete(parentpointer,Pi,19, oldchildentry ) 192224 513 23 17 2730 57 8 1416 2729 3334 3938 19 Lista de valores 24 (is non-leaf)Find i such that Ki <= entry’s keyvalue < Ki+1Delete(nodepointer, Pi,entry, oldchildentry)(is non-leaf)Find i such that Ki <= entry’s keyvalue < Ki+1Delete(nodepointer, Pi,entry, oldchildentry)(Is leaf)Has entries to spareRemove entryReturn

6
Delete(parentpointer,Pi,24, oldchildentry ) 2224 513 23 17 2730 57 8 1416 2729 3334 3938 19 Lista de valores 24 Próximo (is non-leaf)Find i such that Ki <= entry’s keyvalue < Ki+1Delete(nodepointer, Pi,entry, oldchildentry)(is non-leaf)Find i such that Ki <= entry’s keyvalue < Ki+1Delete(nodepointer, Pi,entry, oldchildentry)(Is leaf)Doesn’t have entries to spare – Merge L and SOldchildentry = &

7
22 513 23 17 2730 57 8 1416 2729 3334 3938 19 Lista de valores 24 29 27 301730 New Root Fim Move all entries from M to node on leftReturnRemove *Oldchildentry from NDoesn’t have entries to spare – Merge N and SPull spliting key from parent down into node on leftMove all entries from M to node on leftReturn

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google