Data Structures & AlgorithmsModerateTCS NQT · Infosys pattern

What is the minimum possible height of a binary tree with 100 nodes (height of a single node = 0)?

  1. A. 7
  2. B. 6
  3. C. 5
  4. D. 50

Correct answer: B. 6

A tree of height h holds at most 2^(h + 1) − 1 nodes; h = 5 allows only 63 and h = 6 allows 127 ≥ 100, so the minimum is ⌊log₂ 100⌋ = 6. 7 is the number of levels.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic