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
Lista de valores Root 1 Folhas 1 2 Próxima Página 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 = & Set sibling poiters in L and L2Return (newchildentry = & )

3
Fim Root (has no space)Split NNewchildentry = & N is rootCreate new node with (pointer to N, ) Make the tree’s root-node pointer to the new node;return Root

4
Algoritmo de Remoção Raghu Ramakrishman

5
Delete(parentpointer,Pi,19, oldchildentry ) 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 ) 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
Lista de valores 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