GATE / CS ARCHIVE

GATE CSE 2000 / QUESTION 21(b)

Redistribute before splitting B-plus leaves

Database Management Systems · Indexing, Storage & Query Processing · Full GATE CSE 2000 paper

GATE 2000, Q21(b) Descriptive
Report issue

Indexing, Storage & Query Processing

Question 21(b), 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. Modify insertion: before splitting an overflowing/full target, move one value to its left sibling if that sibling exists and has room; otherwise split. Show the tree after inserting 1 through 9.
Question 21(b), 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. Modify insertion: before splitting an overflowing/full target, move one value to its left sibling if that sibling exists and has room; otherwise split. Show the tree after inserting 1 through 9.
Tap to enlarge
Answer & solution

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

The final tree under the stated overflow-split convention is:

                 [5]
                /   ╲
      [1 2 3 4] → [5 6 7 8 9]

At the first overflow there is no left sibling, so the first six keys split as usual into [1,2,3] and [4,5,6]. Increasing insertions fill the right leaf through 8. To accommodate 9, that target leaf would contain [4,5,6,7,8,9], but the left sibling has spare capacity. Move its smallest key4 to the left sibling, and keep [5,6,7,8,9] on the right. Moving the smallest, rather than the largest, preserves the global leaf ordering. Update the parent separator from 4 to 5 because the right leaf’s minimum changed. No new leaf is needed. Equivalently one can redistribute4 just before inserting 9 into the full right leaf. Do not split again merely because the right leaf has five entries: five is its legal maximum; the sixth causes overflow. Separator conventions and split timing must be consistent with part(a).

Original paper, page 10