Question
In a -tree where each node can hold at most four key values, a root to leaf path consists of the following nodes:
The *-marked keys signify that these are data entries in a leaf.
Assume that a pointer between keys and points to a subtree containing keys in , and that when a leaf is created, the smallest key in it is copied up into its parent.
A record with key value is inserted into the -tree.
The smallest key value in the parent of the leaf that contains is __________. (Answer in integer)
Official answer and solution
- Official answer
- 33
- From
- Official GATE 2025 answer key
Solution
Trace the leaf split of upon inserting , followed by the internal node split of when the copied-up key overflows .
- Insertion into leaf : Key belongs in leaf (which is pointed to by the pointer between and in ). Inserting causes to overflow with keys .
- Splitting leaf : splits into two leaves (either and with copied up, or and with copied up).
- Splitting internal node : Inserting into parent gives keys , causing to overflow.
- In an internal node split of a -tree, the middle (3rd) key is pushed up into root (making ).
- Internal node splits into left node (covering keys ) and right node (covering keys in ).
- Since , the leaf containing is the leftmost child of . The smallest key value in is .
33
Assuming (23 or 25) remains inside the right split of internal node instead of being pushed up to parent .
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.