GATE / CS ARCHIVE

GATE CSE 1997 / QUESTION 19(b)

Maximize internal B+-tree nodes

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

GATE 1997, Q19(b) 1 mark · Descriptive
Report issue

Indexing, Storage & Query Processing

Question 19(b), GATE 1997: In this question a B+-tree of order d has d to 2d key entries in each nonroot internal node, and an internal node with M keys has M+1 children. An internal root has 1 to 2d keys. All leaves are at equal edge-distance h from the root. Use this stated convention, not the alternative convention that “order” means maximum fan-out. For d=4 and exactly 52 leaves, find the maximum number of internal nodes.
Question 19(b), GATE 1997: In this question a B+-tree of order d has d to 2d key entries in each nonroot internal node, and an internal node with M keys has M+1 children. An internal root has 1 to 2d keys. All leaves are at equal edge-distance h from the root. Use this stated convention, not the alternative convention that “order” means maximum fan-out. For d=4 and exactly 52 leaves, find the maximum number of internal nodes.
Question 19(b), GATE 1997: In this question a B+-tree of order d has d to 2d key entries in each nonroot internal node, and an internal node with M keys has M+1 children. An internal root has 1 to 2d keys. All leaves are at equal edge-distance h from the root. Use this stated convention, not the alternative convention that “order” means maximum fan-out. For d=4 and exactly 52 leaves, find the maximum number of internal nodes.
Tap to enlarge
Answer & solution

Answer: 13 internal nodes, attainable at height 3. (no official key was published)

With 52 leaves, the total number of internal key entries is 52−1=51. If there are I internal nodes, the root uses at least one key and every other internal node uses at least d=4. Hence

1+4(I−1)≤51,
so 4I≤54 and I≤13.

An upper bound alone is not enough: equal leaf depth might prevent attaining it. Here it is attainable. Build a height-3 tree as follows:
Depth 0: one root with two children (one key).
Depth 1: two internal nodes, each with five children (four keys each).
Depth 2: ten internal nodes. Give eight of them five leaf children and two of them six leaf children.
Depth 3: 8·5+2·6=52 leaves.

Every nonroot internal node has five or six children, within the permitted five-to-nine range for d=4. All leaves are at depth three. The internal-node count is 1+2+10=13, and their key total is 1+8+8·4+2·5=51, confirming the arithmetic.

Thus 13 is both an upper bound and an achievable maximum. Treating order 4 as a maximum of four children would use a different B+-tree definition and give a wrong result for the convention explicitly supplied in this paper.

Original paper, page 9