Data Structures & AlgorithmsVery hardGATE CS · Product-company placement

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

  1. A. 32 and 511
  2. B. 31 and 448
  3. C. 31 and 511
  4. D. 63 and 511

Correct answer: C. 31 and 511

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^1) = 2t^2 − 1 = 31. Maximum: every node full with 2t children: (2t)^3 − 1 = 511.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic