GATE | GATE CS 2008 | Question 41

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?
(A) 3
(B) 4
(C) 5
(D) 6


Answer: (C)

Explanation:

Insertion of 3 keys
10 20 30

Insertion of 4th key (1st split)
     30
   /   \
10*20   40


Insertion of 5th key no split 
To maximize splits, let us insert a value in a node that has
key in access. Let us insert 5
      30
   /     \
5*10*20   40


Insertion of 6th key (2nd Split)
To maximize splits, let us insert a value in a node that has
key in access. Let us insert 6
      8*30
   /   |   \
5    10*20   40 


Insertion of 7th key
To maximize splits, let us insert a value in a node that has
key in access. Let us insert 15
        8*30
   /     |    \
5    10*15*20   40 



Insertion of 8th key (3rd Split)
To maximize splits, let us insert a value in a node that has
key in access. Let us insert 12
      8*12*30
   /   /   \  \
 5   10 15*20  40 


Insertion of 9th key 
To maximize splits, let us insert a value in a node that has
key in access. Let us insert 17
      8*12*30
   /  /   \   \
5  10 15*17*20 40 

Insertion of 10th key (4th and 5th Splits)
To maximize splits, let us insert a value in a node that has
key in access. Let us insert 13
          12
       /      \
      8       15*30
   /   \     /  |  \  
  5    10  13 17*20   40 


Quiz of this Question

GATE CS Corner    Company Wise Coding Practice

Recommended Posts:



0 Average Difficulty : 0/5.0
No votes yet.