Computer Science EngineeringHard

How many leaf nodes does a binary heap stored in an array of 15 elements have?

  1. A. 4
  2. B. 6
  3. C. 7
  4. D. 8

Correct answer: D. 8

Indices 8 to 15 are leaves, i.e. ceil(n/2) = 8 leaves.

More Algorithms, Data Structures & Programming (ISRO CS) questions

Exams that ask this topic