Question

In a B+\text{B}^+-tree where each node can hold at most four key values, a root to leaf path consists of the following nodes:

A=(49,77,83,−),  B=(7,19,33,44),  C=(20∗,22∗,25∗,26∗)A = (49, 77, 83, -), \; B = (7, 19, 33, 44), \; C = (20^*, 22^*, 25^*, 26^*)

The *-marked keys signify that these are data entries in a leaf.

Assume that a pointer between keys k1k_1 and k2k_2 points to a subtree containing keys in [k1,k2)[k_1, k_2), and that when a leaf is created, the smallest key in it is copied up into its parent.

A record with key value 2323 is inserted into the B+\text{B}^+-tree.

The smallest key value in the parent of the leaf that contains 25∗25^* is __________. (Answer in integer)

Official answer and solution
Official answer
33
From
Official GATE 2025 answer key

Solution

Trace the leaf split of CC upon inserting 23∗23^*, followed by the internal node split of BB when the copied-up key overflows BB.

  1. Insertion into leaf CC: Key 23∗23^* belongs in leaf C=(20∗,22∗,25∗,26∗)C = (20^*, 22^*, 25^*, 26^*) (which is pointed to by the pointer between 1919 and 3333 in BB). Inserting 23∗23^* causes CC to overflow with 55 keys (20∗,22∗,23∗,25∗,26∗)(20^*, 22^*, 23^*, 25^*, 26^*).
  2. Splitting leaf CC: CC splits into two leaves (either (20∗,22∗)(20^*, 22^*) and (23∗,25∗,26∗)(23^*, 25^*, 26^*) with kup=23k_{\text{up}} = 23 copied up, or (20∗,22∗,23∗)(20^*, 22^*, 23^*) and (25∗,26∗)(25^*, 26^*) with kup=25k_{\text{up}} = 25 copied up).
  3. Splitting internal node BB: Inserting kup∈{23,25}k_{\text{up}} \in \{23, 25\} into parent B=(7,19,33,44)B = (7, 19, 33, 44) gives 55 keys (7,19,kup,33,44)(7, 19, k_{\text{up}}, 33, 44), causing BB to overflow.
    • In an internal node split of a B+\text{B}^+-tree, the middle (3rd) key kupk_{\text{up}} is pushed up into root AA (making A=(kup,49,77,83)A = (k_{\text{up}}, 49, 77, 83)).
    • Internal node BB splits into left node B1=(7,19)B_1 = (7, 19) (covering keys <kup< k_{\text{up}}) and right node B2=(33,44)B_2 = (33, 44) (covering keys in [kup,49)[k_{\text{up}}, 49)).
  4. Since 25≥kup25 \ge k_{\text{up}}, the leaf containing 25∗25^* is the leftmost child of B2=(33,44)B_2 = (33, 44). The smallest key value in B2B_2 is 3333.
Final answer

33

Common trap

Assuming kupk_{\text{up}} (23 or 25) remains inside the right split of internal node BB instead of being pushed up to parent AA.

The answer is the one in the official GATE answer key. The solution is this site's own explanation.

Source

Paper
GATE 2025 Computer Science and Information Technology - Session 2 (CS2)
Question
57 of 65
Section
Computer Science and Information Technology

Report an error in this question

GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.