The Gateway to Computer Science Excellence
0 votes

If following sequence of keys are inserted in a B+ tree with K(=3) pointers:

8, 5, 1, 7, 3, 12, 9, 6

Which of the following shall be correct B+ tree?

in Others by Veteran (105k points) | 3.2k views

1 Answer

+3 votes
Best answer

8, 5, 1, 7, 3, 12, 9, 6 

first 8,5 will  enter in the node then 1 comes so node will split from the middle and 5 becomes parent and its copy is retained in leaf node  at left side . rest process is given in given pic

so ans is 1

note only when a leaf node is split it s copy is retained in leaf node . when an internal node is split then there is no need of copying it as its copy is already in leaf node earlier 

by Boss (49.3k points)
edited by
Your answer is right but there is some confusion ,Why 3 is present on left side of 3 in leaf node , it should be on right side of it as elts equal or greater than 3 must present on right side. Similarly for 5
it can go either way depending upon the options given to us
Sir can u please explain the concept of splitting  the node and how to decide where to repeat the value left or right

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,737 questions
57,321 answers
105,155 users