+24 votes
3.9k views

A B-tree of order $4$ is built from scratch by $10$ successive insertions. What is the maximum number of node splitting operations that may take place?

1. $3$
2. $4$
3. $5$
4. $6$
asked
edited | 3.9k views
0
Add the question.
0
Question ??
0
I can't see the question!! I can only see the heading GATE 2008_41. It would be better to post the whole question.
0
It was there, but was an image. The images are bad and we are in the process of replacing them. I have now edited it. Are you accessing from mobile?
0
No I am accessing the site from my laptop.Now i can see the question.
+1
Okay. Might be resolution problem then. Image was actually well visible for me. I have now removed it and replaced with text.

## 6 Answers

+38 votes
Best answer

Total 5 splitting will occur during $10$ successive insertions

Let's take $10$ successive key values as $\{1,2,3,\ldots 10\}$ which can cause maximum possible splits.

answered by Loyal (8.2k points)
edited
+1
Can the answer be different if the elements were different?? How can we prove that the result will hold true for any possible series?
+5
anchitjindal07

question asking for "maximum number of node splitting operations" so we think in worst case

worst case will when we insert elements into same side always
0
nice job prateek thanks
0
Someone please provide me link to understand insertions and deletions in B and B+ tree properly. I am facing difficulties in this exact topic.
0
What would be general formula? p be order and n insertion????
+16 votes

Let 1 to 10 be inserted

Insertion of 123 does not cause any split

When we insert 4 split occurs

We use right bias

2

1              3456

Again on insertion of 6 split occurs

2 4

1         3        56

7 does not cause split

2 4

1         3          5678

8 cause  split

2  4   6

1       3    5    7 8

Inserting 9 wont cause any split

2  4   6

1       3    5    7 8 9

Inserting 10 causes split at leaf and non leaf node

4

2          6   8

1    3    5   7    9 10

So total 5 splits

answered by Boss (31.9k points)
+2
It is not B+ tree.
+1
why replicate data?
+1
I read it as B+tree..edited now..
0
How can we decide to split 2nd element in this case? Why Not 3rd element?
Is there any condition for that?
0
why 2nd element why cant 3rd element split
0
Third element split has been illustrated above and it does not give max number of splits. It gives only three splits. It also has to do with the type of numbers chosen.
0
if B+ tree is used then what will be the structure of the tree ??
0
We can not apply biasing in b tree and we can apply biasing only in BPlus tree is it rite?
+8 votes
In this ques we can splits a node with two methods which is based on chosing mid element  ,

1-Right bias (#keys in right > #keys in left or  choosing mid elem is N/2 th element ) ,then no SPLITS =5

2-Left bias (#keys in left > #keys in left or  choosing mid elem is (N/2 +1) th element) ,then no SPLITS =3  ,where N is even.

so, MAX # splits = 5 .

Ans is C:5
answered by Junior (855 points)
+4 votes
5 splitings
answered by Active (2.6k points)
+4 votes
Answer: C

Insert 10,20,30,40,5,6,15,12,17,13 (in that order). You will get five splittings.
answered by Boss (34.1k points)
0 votes
ans 3
answered by Loyal (5.3k points)
0
Please explain...
+2
Consider the sequence 1 to 10 for insertion. Since the order is 4, the max number of keys would be 3 and min number of keys would be 1.

Now, first three insertions will not cause a split: 1/2/3

The fourth insertion causes split:

3

1/2          4

Now, the fifth and sixth insertions will not result in a split:

3

1/2          4/5/6

Now, the seventh insertion will create a split:

3/6

1/2          4/5      7

Now, eight and ninth insertions will not create a split:

3/6

1/2          4/5      7/8/9

Now, the tenth insertion causes split :

3/6/9

1/2          4/5      7/8      10

We have 3 splits. But, this is not the maximim number of splits. For max number of split we need insert along the leaves which have the majority elements, shown below by other users. Therefore 3 is not the right answer.
0
what is the rule for splitting , because minimum way I can split the node is 3 and the maximum way is 8
0

thanks @Sriram Karunagaran, :)

0
Split would be required when key items=4

If i put n/2th element in the upper level while splitting, then splits=5

Otherwise put (n/2+1) th element in upper level, then split=3
Answer:

+16 votes
1 answer
1
+31 votes
4 answers
2
+28 votes
2 answers
3
+26 votes
5 answers
4
+35 votes
4 answers
5
+25 votes
4 answers
6
+16 votes
4 answers
7