GATE / CS ARCHIVE

SIMILAR QUESTIONS / DATABASE MANAGEMENT SYSTEMS

Insert into B+ leaves and propagate separator splits

3 questions solved the same way, newest first. Back to Database Management Systems

How these are solved

Locate the leaf, insert in order, split at capacity, copy/promote separators according to leaf/internal rules, and propagate to the root. Fanout and occupancy conventions stay source-specific.

1 mark · MSQ
Report issue

Following a B+ tree split to the root

Indexing, Storage & Query Processing

Question 21, GATE 2025: A pictured B+ tree has a root with keys [6,12,19] and four leaf children, shown left to right as [1,4,3], [7,9,10], [13,15,17], [20,21,22]. Each node holds at most three keys, and there are five nodes initially. Insert 23 using ordinary B+ tree insertion. Which statements hold? A no node splits; B at least one node splits and redistributes; C node count stays unchanged; D height increases. The unsorted first leaf [1,4,3] is reproduced literally, not silently repaired.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: B, D

Approach: Follow the insertion path and propagate any overflow upward.
Because 23 exceeds the largest root separator, it routes to the rightmost leaf [20,21,22]. Adding it produces four keys in a node whose capacity is three. This leaf must split into two leaves under the ordinary insertion algorithm; for example its data can be distributed as [20,21] and [22,23]. A separator for the new leaf is inserted into the parent.
The parent is the root and is already full with three keys. Its overflow requires an internal-node split and a new root above the split pieces. Thus the height increases by one. B and D are true, while A and C are false. The usual allocation adds one leaf, one internal node and one new root, raising five nodes to eight.
the printed first leaf is unsorted, so the figure is not literally a valid B+ tree. Separator conventions also are not fully specified. The intended overflow argument uses the unaffected rightmost branch and assumes a valid initial tree apart from the diagram defect. The official B;D answer is preserved, with that limitation explicit.

Original paper, page 21 · Answer key

2 marks · NAT
Report issue

Indexing, Storage & Query Processing

Question 57, GATE 2025: A B+ tree node holds at most four keys. One root-to-leaf path is A=(49,77,83,−), B=(7,19,33,44), C=(20*,22*,25*,26*), where stars mark leaf data entries. A pointer between separators k1,k2 covers [k1,k2), and a newly created leaf copies its smallest key into its parent. Insert key 23. What is the smallest separator key in the parent of the resulting leaf that contains 25*?
Tap to enlarge
Answer & solution

Official answer: 33

The insertion belongs in C because 19≤23<33. Its sorted data entries become [20*,22*,23*,25*,26*], exceeding the four-key limit, so C splits. With a 2/3 split, the leaves are [20*,22*] and [23*,25*,26*], and separator 23 is copied up. With a 3/2 split, they are [20*,22*,23*] and [25*,26*], and separator 25 is copied up. Let k be that copied separator, either 23 or 25.

B was already full. After receiving k, its ordered separators are [7,19,k,33,44], so B must split as well. For an internal-node split, the middle separator k is promoted to A rather than kept as a key in either split internal node. The left internal node retains [7,19], and the right retains [33,44]. The leaf holding 25* is on the right side of k and is a child of this right internal node.

Consequently its parent's smallest stored key is 33, even though that parent has a leftmost child whose values can be smaller than 33. A had spare capacity, so receiving k causes no further split. The unspecified 2/3 versus 3/2 leaf convention does not change the requested answer: 33.

Original paper, page 43 · Answer key

Report issue

Draw B-plus tree after six inserts

Indexing, Storage & Query Processing

Question 21(a)(i), GATE 2000: An initially empty B+-tree allows up to 5 keys per leaf and up to 5 separator keys per internal node. Insert distinct keys in increasing order. Use standard overflow splitting: a sixth leaf key yields two 3-key leaves, and copy the right leaf minimum into the parent; leaf data keys stay in leaves. Show the tree after inserting 1 through 6, without intermediate diagrams.
Question 21(a)(i), GATE 2000: An initially empty B+-tree allows up to 5 keys per leaf and up to 5 separator keys per internal node. Insert distinct keys in increasing order. Use standard overflow splitting: a sixth leaf key yields two 3-key leaves, and copy the right leaf minimum into the parent; leaf data keys stay in leaves. Show the tree after inserting 1 through 6, without intermediate diagrams.
Question 21(a)(i), GATE 2000: An initially empty B+-tree allows up to 5 keys per leaf and up to 5 separator keys per internal node. Insert distinct keys in increasing order. Use standard overflow splitting: a sixth leaf key yields two 3-key leaves, and copy the right leaf minimum into the parent; leaf data keys stay in leaves. Show the tree after inserting 1 through 6, without intermediate diagrams.
Tap to enlarge
Answer & solution

Answer: Root [4]; linked leaves [1,2,3] → [4,5,6]. (no official key was published)

The requested final tree is:
             [4]
            /   ╲
     [1 2 3] → [4 5 6]

The first five keys fit in the single root-leaf. Inserting 6 overflows its capacity to six keys, so divide its sorted entries evenly into [1,2,3] and [4,5,6]. Create an internal root with separator 4, the minimum of the right child. A search for a key below 4 chooses the left child and a search for 4 or greater chooses the right. Because this is a B+-tree, copying 4 to the parent does not remove 4 from the leaf. The arrow denotes the leaf-level successor link. The stem does not define its separator convention; a max-left convention can instead display root[3] with the same leaves. Here and in subsequent parts the minimum-of-right convention is fixed explicitly.

Original paper, page 10