CS FundamentalsVery hardGATE CS

A B+ tree stores 1,000,000 keys. Each internal node has at most 50 children (at least 25, except the root, which needs at least 2), and each leaf holds 20 to 40 keys. Counting the leaf level, how many levels can the tree have?

  1. A. Exactly four
  2. B. 3 to 4
  3. C. 4 to 5
  4. D. 3 to 5

Correct answer: C. 4 to 5

Fewest levels: at least 25,000 leaves are needed and 50³ = 125,000 ≥ 25,000 but 50² is not, so 4. Most levels: there are at most 50,000 leaves, and a tree of h levels has at least 2 × 25^(h−2) leaves, which is 31,250 for h = 5 but 781,250 for 6, so 5. Forgetting the root's lower limit of 2 gives exactly 4.

More DBMS and SQL questions

Exams that ask this topic