1

I'm working on a homework problem involving B+ Trees. The question asks us to insert (2,3,5,7,11,17,19,23,29,31) in a B+ Tree whose node structure has 4 pointers.

This is where I have reached.

Solution so far

Image 2

I want to know if now, to inset 17 should I split the current node into two and distribute key-values (Same as step 2 : Image 1) or should I move 5 to the leaf node on left and update key-value in parent node to 7 and the insert 17 by shifting 7 and 11 one place left(As in image 2)? The second approach would impose computational overhead but will save space. But there is no mention of this in the text.(Database System Concepts)

Vishal Dalwadi
  • 238
  • 1
  • 4
  • 12
  • you have to insert in the right node, whitchh has to be broken down to fit the 4 pointers criteria. and the rest should be clear – nbk Sep 01 '19 at 16:04
  • @nbk Okay Thanks. So what should be done about the wasted space? The key-values are already sorted. So no other key-value will occupy that place. – Vishal Dalwadi Sep 01 '19 at 16:34
  • The interesting thing about the b Trees in general is their depth and a b+ tree keeps everything balanced.so that you can find an element. But you don't have wasted space, you have a sleight overhead. that comes with the territory. in your case every node has two elements at the end, and that is a third overhead – nbk Sep 01 '19 at 16:53

0 Answers0