Data Structures & AlgorithmsVery hardGATE CS

A B-tree has minimum degree t = 4 (every non-root node has between 3 and 7 keys) and height 3 (a root-only tree has height 0). What are the minimum and maximum numbers of keys it can hold?

  1. A. 128 and 4095
  2. B. 127 and 3584
  3. C. 255 and 4095
  4. D. 127 and 4095

Correct answer: D. 127 and 4095

Minimum: root with 1 key and 2 children, then 4 children per node, each node holding 3 keys: 1 + 2(t − 1)(1 + t + … + t^2) = 2t^3 − 1 = 127. Maximum: every node full with 2t children: (2t)^4 − 1 = 4095.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic