algorithm - Deletion from B-Tree - M=5 -


i'm dealing deletion in btree in specific case

m=5 - - maximum number of keys in node 4 , minimum number of keys in node 2

now when deleting in btree using defensive approach (i must use one) when approach node must guarantee has 1 key more minimum required.

here problem - let's have root 1 key , 2 children 2 keys each. when approach 1 of these children have guarantee has @ least 3 keys (because m=5).

i have 2 ways - borrow neighbor or borrow father , merge. can't borrow neighbor has minimum of 2 keys borrowing father , merging creates node 5 keys - , it's more maximum of allowed keys (as m=5).

what should in case? more - correct way treat such situation

classical b-trees constrain key counts non-root nodes lie between d , 2d d. means merging of nodes possible if underflow has already occurred , other node involved in merge has minimum occupancy. separator key pulled parent node makes key count of (d - 1) + d + 1 = 2d, maximum fits node. merging on way down 'just in case' not possible.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -