GATE Computer ScienceVery hardGATE CS

A B-tree with minimum degree t = 3 (every node except the root has between 2 and 5 keys) is built with the CLRS insertion procedure, which splits any full node (5 keys) it meets on the way down before descending. Keys 1, 2, 3, ..., 30 are inserted in increasing order. How many nodes does the final tree have?

  1. A. 13
  2. B. 12
  3. C. 16
  4. D. 14

Correct answer: D. 14

Sequential insertion always splits the rightmost full node, leaving the left halves with only 2 keys each (the minimum). The simulation gives 11 splits and a final tree of height 2 with 14 nodes in total (1 root, 3 internal nodes and 10 leaves).

More Programming and Data Structures (GATE) questions

Exams that ask this topic