In a B+ - tree where each node can hold at most four key values, a root to…
2025
In a 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*)
The *-marked keys signify that these are data entries in a leaf.
Assume that a pointer between keys 𝑘1 and 𝑘2 points to a subtree containing keys in [𝑘1, 𝑘2), and that when a leaf is created, the smallest key in it is copied up into its parent.
A record with key value 23 is inserted into the B+ - tree.
The smallest key value in the parent of the leaf that contains 25* is __________. (Answer in integer)
Attempted by 108 students.
Show answer & explanation
Correct answer: 33
Answer: 33
Key insight: inserting 23 causes the leaf to overflow and split; the smallest key of the new right leaf is copied up, which then causes the parent to overflow and split, producing a new internal node whose smallest key is 33.
Locate the leaf: the leaf with entries 20, 22, 25, 26 lies under the parent with keys 7, 19, 33, 44, in the interval [19, 33).
Insert 23 into that leaf, producing entries 20, 22, 23, 25, 26. This exceeds the leaf capacity of 4, so the leaf splits.
Split result (typical split into 3 and 2): left leaf = [20, 22, 23], right leaf = [25, 26]. The smallest key of the right leaf, 25, is copied up into the parent as a separator.
Inserting 25 into the parent (which was 7, 19, 33, 44) creates 7, 19, 25, 33, 44, which overflows the parent (capacity 4).
Split the internal node of 5 keys by promoting the middle key (25) to the root. The original parent splits into two internal nodes: left = [7, 19], right = [33, 44].
The right internal node [33, 44] becomes the parent of the leaf [25, 26]. The smallest key value in that parent is 33.
Therefore, the smallest key value in the parent of the leaf that contains 25 is 33.
A video solution is available for this question — log in and enroll to watch it.