GATE / CS ARCHIVE

SUBJECT COLLECTION

Data Structures · B-Trees & Multiway Search Trees

11 questions, newest first

GATE CSE has asked 11 questions on B-Trees & Multiway Search Trees (Data Structures) from 1992 to 2024, in 9 of the 46 papers; the most recent is in GATE CSE 2024 Set 1. In the last five years it carried 0.1 marks per 100-mark paper on average, against 0.2 since 2003. Since 2014 the questions have been 1 MCQ and 1 NAT.

Browse topics
1 mark · MCQ
Report issue

Root exception to B+ tree occupancy

B-Trees & Multiway Search Trees

Question 21, GATE 2024: In a B+ tree, which nodes are exempt from the general requirement of at least 50% occupancy? A Only the root; B all leaves; C all internal nodes; D only the leftmost leaf.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Approach: Separate the root's special role from the minimum-occupancy rules for ordinary nodes.
1. A B+ tree keeps nonroot nodes sufficiently full so that the number of nodes, and hence the height and search cost, stay controlled. Splitting, redistribution and merging maintain these lower bounds after updates.
2. The root needs an exception. If the entire tree fits in one leaf, that root leaf can contain only a few records. If the root is internal, it may have just two children even when the ordinary minimum for an internal node is larger.
3. Giving all leaves or all internal nodes the same exemption would abandon the normal occupancy guarantee. Being the leftmost leaf does not create an exception either.
Answer: A. Precise key-versus-child counts depend on the chosen order convention, but the special status of the root does not.

Original paper, page 15 · Answer key

2 marks · NAT
Report issue

B-Trees & Multiway Search Trees

Question 49, GATE 2017: In a B+ tree, search keys occupy 8 bytes, blocks are 512 bytes, and block pointers occupy 2 bytes. What is the maximum order of the tree?
Tap to enlarge
Answer & solution

Official answer: 52.0

Our answer: 52

1. Use the conventional definition of order m as the maximum number of child pointers in an internal node. Such a node needs m pointers and m-1 separator keys, since keys separate adjacent child ranges.

2. The capacity inequality is 2m+8(m-1)≤512. Expanding gives 10m-8≤512, hence 10m≤520 and m≤52.

3. At m=52, the node uses 104 pointer bytes plus 408 key bytes, exactly 512. Increasing to 53 would require 522 bytes, so the maximum is 52. This is an internal-node calculation that ignores unspecified metadata; a different convention defining order as the number of keys must not be substituted silently.

Original paper, page 20 · Answer key

2 marks · MCQ
Report issue

Maximum B-plus leaf splits

B-Trees & Multiway Search Trees

Question 44, GATE 2009: Insert 10, 3, 6, 8, 4, 2, 1 into an empty B+ tree. Internal nodes allow at most 3 child pointers; leaves at most 2 data items. What is the maximum number of leaf splits, allowing valid choices of how 3 overflow items split? A 2; B 3; C 4; D 5.
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

There can be at most one leaf split per insertion; the first two keys fit in the initial two-item leaf, so at most five splits occur. This bound is attained by leaving two smaller keys in the left leaf and one larger key in the right leaf at each overflow. Starting[3, 10], insertion 6 gives[3, 6]|[10]; 8 gives[3, 6]|[8]|[10]; 4 gives[3, 4]|[6]|[8]|[10]; 2 gives[2, 3]|[4]|[6]|[8]|[10]; 1 gives[1, 2]|[3]|[4]|[6]|[8]|[10]. Thus all five later insertions split a leaf, D. Internal-node splits are not counted. Exhaustive permitted split-choice enumeration confirms the maximum 5.

The first two insertions cannot split a capacity-two leaf. There are only five insertions left and each can overflow at most one leaf, so five is an upper bound. The explicit sequence of valid 1/2 splits in the baseline attains one split on each remaining insertion. That witness proves the maximum, not merely an observed count under one fixed implementation. Promoted separator changes and internal-node splits do not add to the requested leaf-split count.

Original paper, page 10

2 marks · MCQ
Report issue

Maximum splits in an order-four B-tree

B-Trees & Multiway Search Trees

Question 41, GATE 2008: A B-tree of order 4 is built from empty by ten successive insertions. What is the maximum number of node-splitting operations?

(A) 3
(B) 4
(C) 5
(D) 6
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

1. An order-four B-tree has at most three keys per node. The maximum is five splits. For ordinary overflow-triggered insertion, inserting 1 through 10 in ascending order and promoting the lower middle key splits a leaf on insertions 4, 6, 8 and 10; the fourth leaf split also overflows and splits the root. For a timing-independent bound, after L leaf splits there are L+1 nonempty leaves. A B-tree with L+1 leaves has exactly L separator keys in all internal nodes combined: each internal node has one fewer key than children, and summing over the tree gives leaves minus one.
2. Consequently n≥(L+1)+L=2L+1. With n=10, L≤4. Under overflow-triggered insertion, the first internal split needs the root to receive four separators from four leaf splits. With no further leaf split possible, no second internal split can occur. Thus there is at most one internal/root split and the total is at most 4+1=5.
3. Under preemptive splitting, the full root may instead split after three leaf splits, distributing its three separators into a new root with one key and two internal children with one key each. At most one further leaf split is possible, which can increase only one such child to two keys; no internal node can become full again. The same upper bound therefore holds, and increasing-key insertion attains five splits under this convention too.

Original paper, page 7

2 marks · MCQ
Report issue

Inserting a key in a 2–3–4 tree

B-Trees & Multiway Search Trees

Question 65, GATE 2003: A 2–3–4 tree (B-tree of minimum degree 2) stores letters in alphabetical order. Its root is [L,P,U], with leaf children [B,H,I], [N], [Q,T], [V,X,Z] from left to right. GateForum asks for the result of inserting G; that request is omitted in GFG. Candidate trees (children listed left to right) are:
A. Root [P]; internal children [G,L] and [U]. Their leaf children are [B],[H,I],[N] and [Q,T],[V,X,Z].
B. Root [P]; internal children [H,L] and [U]. Their leaf children are [B,G],[I],[N] and [Q,T],[V,X,Z].
C. Root [I,P,U], with leaves [B,G,H],[L,N],[Q,T],[V,X,Z].
D. None of the above.
Use standard split-before-descent insertion to select the conventional result; the statement does not explicitly specify its insertion policy.
Tap to enlarge
Your answer
Answer & solution

Answer: B under standard split-before-descent insertion (no official key was published)

1. A minimum-degree-2 node holds at most three keys. The initial root is full, so split it before descending: promote P to a new root; its children hold [L] and [U]. The old four leaves are divided two per child.
2. G<P and G<L, so descend toward [B,H,I]. This child is full too. Promote its median H into [L], giving [H,L], and replace the leaf by [B] and [I].
3. G<H, so insert it into [B] to obtain [B,G]. The other leaves stay [I],[N],[Q,T],[V,X,Z]. These are exactly the links in B.
4. This is algorithm-dependent: A can arise under a bottom-up split choice, and C under redistribution. Neither the invariants alone nor the incomplete the wording uniquely force B.

Under standard top-down B-tree insertion, first split the full root [L,P,U], promoting P and giving children [L] and [U]. Descending left, split its full child [B,H,I], promoting H into [L] to obtain [H,L] and leaves [B],[I],[N]. Insert G into [B], giving [B,G]. The result is option B, with root [P], left child [H,L] and right child [U]. A different valid insertion policy can produce another valid B-tree: A follows suitable bottom-up split choices, and C uses redistribution to a sibling. Consequently B is the conventional algorithmic answer, not a uniquely forced tree from the B-tree invariants alone.

Original paper, page 9

Descriptive
Report issue

Construct the B+ tree

B-Trees & Multiway Search Trees

Question 22(a), GATE 2001: B+ tree fan-out 3; insert 80,50,10,70,30,100,90, and show snapshots after 10,30,90.
Question 22(a), GATE 2001: B+ tree fan-out 3; insert 80,50,10,70,30,100,90, and show snapshots after 10,30,90.
Tap to enlarge
Answer & solution

Answer: With left-heavy leaf splits: after 10 root[80]; after 30 root[70]; after 90 root[70] with internal children[50] and[80,100]. (no official key was published)

B+ tree fan-out 3, initially empty; insert 80,50,10,70,30,100,90. Use at most 3 child pointers (2 separators) per internal node and at most 2 records per leaf. Non-root internal nodes need ≥2 children; non-root leaves need ≥1 record. Policy: split an overflowing 3-record leaf as 2 records on the left and 1 on the right; copy the minimum key of the right leaf upward. Split an overflowing internal node with 4 children into two groups of 2 children, promoting the middle separator. Internal separators equal the minimum key of their right subtree. Leaf links run left-to-right.

After inserting 10:
        [80]
       /    \
 [10,50] -> [80]

Insert 70: leaves become [10,50],[70],[80], root [70,80]. Inserting 30 splits the first leaf into [10,30] and [50], overflows the root to four children, and creates a new root:

            [70]
          /      \
       [50]      [80]
      /   \     /   \
 [10,30] [50] [70] [80]

Insert 100 into the last leaf. Insert 90 there, split [80,90,100] into [80,90] and [100], and add separator 100 to its parent. Final tree after 90:

             [70]
          /        \
       [50]       [80,100]
      /   \      /   |    \
 [10,30] [50]  [70] [80,90] [100]

Accessible description: root separator 70; left internal separator 50 points to leaves [10,30] and [50]; right internal separators 80,100 point to [70],[80,90],[100]. All leaves have equal depth and are linked in the displayed order. Other consistently applied split policies can yield different valid trees; this is one fully specified construction.

Original paper, page 10

Descriptive
Report issue

Delete from the B+ tree

B-Trees & Multiway Search Trees

Question 22(b), GATE 2001: B+ tree fan-out 3, initially empty; insert 80,50,10,70,30,100,90. Use at most 3 child pointers (2 separators) per internal node and at most 2 records per leaf. Non-root internal nodes need ≥2 children; non-root leaves need ≥1 record. Starting with the final tree of the preceding solution, delete 30 and then 10.
Question 22(b), GATE 2001: B+ tree fan-out 3, initially empty; insert 80,50,10,70,30,100,90. Use at most 3 child pointers (2 separators) per internal node and at most 2 records per leaf. Non-root internal nodes need ≥2 children; non-root leaves need ≥1 record. Starting with the final tree of the preceding solution, delete 30 and then 10.
Question 22(b), GATE 2001: B+ tree fan-out 3, initially empty; insert 80,50,10,70,30,100,90. Use at most 3 child pointers (2 separators) per internal node and at most 2 records per leaf. Non-root internal nodes need ≥2 children; non-root leaves need ≥1 record. Starting with the final tree of the preceding solution, delete 30 and then 10.
Tap to enlarge
Answer & solution

Answer: After 30: leaf [10,30] becomes [10]. After 10: root [80], left internal[70] with [50],[70], right internal[100] with [80,90],[100]. (no official key was published)

Use the exact insertion policy and final tree in part (a). Deletion policy: remove a record, repair an empty leaf by borrowing from an adjacent same-parent sibling if it has spare records; otherwise merge. Repair an underfull internal node by borrowing one child from an adjacent same-parent sibling with spare children; otherwise merge. Update separators to right-subtree minima throughout.

After deleting 30, [10,30] becomes [10]. One record meets the minimum, so no redistribution occurs:

             [70]
          /        \
       [50]       [80,100]
      /   \      /   |    \
   [10] [50]    [70] [80,90] [100]

After deleting 10, the leftmost leaf is empty. Its sibling [50] cannot lend because it has the minimum one record. Merge into [50], remove the obsolete separator 50, and the left internal node temporarily has only one child. Its right internal sibling has three children and can lend its first child [70]. Move that child to the left internal node; update the root separator from 70 to 80. The final tree is:

             [80]
          /        \
       [70]        [100]
      /   \       /    \
   [50]  [70]  [80,90] [100]

Accessible description: root 80 has left internal node 70 with leaf children [50],[70], and right internal node 100 with leaf children [80,90],[100]. The linked leaf sequence is [50]→[70]→[80,90]→[100]. All capacity, occupancy, ordering and equal-depth invariants hold. A different valid policy in part (a) needs its own consistent deletion trace.

Original paper, page 10

5 marks · Descriptive
Report issue

Bound records stored at B-tree leaves

B-Trees & Multiway Search Trees

Question 21, GATE 1999: In a B-tree, every non-root internal node has between m and 2m−1 children inclusive. The root is at level 0; all leaves are at level h≥1. Derive minimum and maximum numbers of records in the leaf nodes.
Tap to enlarge
Answer & solution

Answer: Under standard B-tree key occupancy: minimum 2m^(h−1)(m−1); maximum (2m−1)^h(2m−2). (no official key was published)

State the usual B-tree assumptions explicitly: m≥2, an internal node with c children has c−1 records, the non-leaf root has 2 through 2m−1 children, and non-root leaves carry between m−1 and 2m−2 records. The printed child bound alone does not independently specify leaf capacity; these are the conventional B-tree occupancy rules, not B+ tree rules or the alternative maximum-2m convention.
For the minimum, choose two root children and m children at every internal level below the root. The number of leaves is then Lmin=2mh−1: for h=1 there are two leaves; each further level multiplies their count by m. Filling each leaf with m−1 records gives Rmin=2mh−1(m−1).
For the maximum, root and all other internal nodes have 2m−1 children, so Lmax=(2m−1)h. Filling every leaf with 2m−2 records gives Rmax=(2m−1)h(2m−2). Both bounds are attained by uniformly minimally or maximally occupied levels.
These counts exclude records in internal nodes. For example m=2,h=1 gives 2 to 6 leaf records (2 leaves×1 up to 3 leaves×2), not the 3 to 8 total records including the root. If only the literal internal-child bound is permitted without standard leaf-occupancy rules, leaf record counts are underdetermined; only the leaf-node bounds follow with the usual root rule.

Original paper, page 9

Descriptive
Report issue

B+ tree insertion and splitting

B-Trees & Multiway Search Trees

Question 14(a), GATE 1994: Consider the B+ tree: The root has separators [25,38,69,93] and five linked leaves, left to right: [10,15], [25,36], [39,41,47], [69,71,75,83], [95,99,101,105]. Each node holds d to 2d keys, subject to the usual root exception. GFG asks for the tree after inserting 100; GateForum omits the insertion key.
Question 14(a), GATE 1994: Consider the B+ tree: The root has separators [25,38,69,93] and five linked leaves, left to right: [10,15], [25,36], [39,41,47], [69,71,75,83], [95,99,101,105]. Each node holds d to 2d keys, subject to the usual root exception. GFG asks for the tree after inserting 100; GateForum omits the insertion key.
Question 14(a), GATE 1994: Consider the B+ tree: The root has separators [25,38,69,93] and five linked leaves, left to right: [10,15], [25,36], [39,41,47], [69,71,75,83], [95,99,101,105]. Each node holds d to 2d keys, subject to the usual root exception. GFG asks for the tree after inserting 100; GateForum omits the insertion key.
Tap to enlarge
Answer & solution

Answer: For insertion of 100 with d=2 and splitting rather than redistribution: new root [69], internal children [25,38] and [93,100], with six leaves listed in the diagram. (no official key was published)

1. The four-key leaf requires 2d≥4, so d≥2. The two-key leaves require d≤2. Together these bounds establish d=2 and capacity 2d=4. Insert 100 into [95,99,101,105] to get five sorted keys [95,99,100,101,105].

2. Choose the legal split [95,99] and [100,101,105]. Copy separator 100 into the parent, which becomes [25,38,69,93,100] with six children.

3. The overflowing internal root splits around its middle separator 69. Promote 69 into a new root, leaving internal nodes [25,38] and [93,100], each with three children.

4. All six leaves remain at equal depth and hold between two and four keys. Keys in internal nodes are routing separators, not additional data records.

5. A 3/2 leaf split with separator 101 is also legal if that split convention is used. The problem does not state a tie-breaking split policy; present the selected valid construction rather than claim uniqueness.

Diagram / structural description

Root [69]
  Left internal [25,38] → [10,15] | [25,36] | [39,41,47]
  Right internal [93,100] → [69,71,75,83] | [95,99] | [100,101,105]

All six leaves are linked in the displayed order.

  • The source root contains 38 and 93, although the corresponding right leaves start with 39 and 95. These are valid lower routing boundaries under a separator-range convention; an exact-minimum convention would require 39 and 95 instead. Preserve the source and disclose the convention.

Original paper, page 6

Descriptive
Report issue

B+ tree search height

B-Trees & Multiway Search Trees

Question 14(b), GATE 1994: A B+ tree of order d holds d to 2d keys per node. For n leaf nodes, fill the order of the number of nodes accessed during a search.
Question 14(b), GATE 1994: A B+ tree of order d holds d to 2d keys per node. For n leaf nodes, fill the order of the number of nodes accessed during a search.
Question 14(b), GATE 1994: A B+ tree of order d holds d to 2d keys per node. For n leaf nodes, fill the order of the number of nodes accessed during a search.
Tap to enlarge
Answer & solution

Answer: O(1+log_(d+1) n); commonly written O(log_d n) for d≥2 and nontrivial trees. (no official key was published)

1. An internal non-root node has at least d+1 children because keys separate child ranges. A root that is internal has at least two children.

2. If the root-to-leaf distance is h≥1, there are at least 2(d+1)h−1 leaves. Rearranging bounds h by 1+logd+1(n/2).

3. Search follows a single child at each internal level and accesses the leaf, for h+1 node accesses. The extra constant handles n=1.

4. For d≥2, changing the logarithm base from d+1 to d changes only a bounded factor; logd n is the conventional blank. When d=1, logd n is undefined, so the d+1 expression is safer.

Original paper, page 6

Report issue

Internal nodes of a 2–3 tree

B-Trees & Multiway Search Trees

Question 2(vii), GATE 1992: A 2–3 tree has nine leaves, all at equal depth, and every internal node has two or three children. Which internal counts 4, 5, 6, 7 are possible?
Question 2(vii), GATE 1992: A 2–3 tree has nine leaves, all at equal depth, and every internal node has two or three children. Which internal counts 4, 5, 6, 7 are possible?
Tap to enlarge
Select all that apply
Answer & solution

Answer: A, D: 4 and 7 (no official key was published)

At height two, the root must have three children and each must have three leaves, giving 1+3=4 internal nodes and nine leaves. At height three, nine leaves require four parents at the deepest internal level, since five would already require ten leaves. The preceding level must therefore have two nodes with two children each, and the root has those two children. Internal count is 1+2+4=7; give one deepest node three leaves and the others two to get nine. Greater height needs at least sixteen leaves. Thus counts 5 and 6 cannot fit the equal-depth constraint.

Original paper, page 2