GATE / CS ARCHIVE

GATE CSE 2000 / QUESTION 21(a)(ii)

Draw B-plus tree after ten inserts

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

GATE 2000, Q21(a)(ii) Descriptive
Report issue

Indexing, Storage & Query Processing

Question 21(a)(ii), 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 10, without intermediate diagrams.
Question 21(a)(ii), 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 10, without intermediate diagrams.
Question 21(a)(ii), 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 10, without intermediate diagrams.
Tap to enlarge
Answer & solution

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

The requested tree is:
                  [4 | 7]
                /    |    ╲
       [1 2 3] → [4 5 6] → [7 8 9 10]

After the first split, increasing keys always enter the rightmost leaf. That leaf fills with 4,5,6,7,8 and overflows on 9. Splitting its six keys yields [4,5,6] and [7,8,9]; copy 7 into the existing root. The root now has two separators and three child pointers, well within its five-key capacity, so it does not split. Insert 10 into the rightmost leaf to get [7,8,9,10]. The first leaf remains [1,2,3]. Separators4 and 7 remain present in their respective data leaves. Under a max-left separator convention the same leaf layout can be shown with root[3,6]; the answer above uses the stated minimum-of-right convention throughout.

Original paper, page 10