GATE Computer ScienceVery hardGATE CSE

In how many different ways can the keys 1, 2, …, 7 be arranged in the array of a binary max-heap (every parent greater than its children)?

  1. A. 64
  2. B. 90
  3. C. 70
  4. D. 80

Correct answer: D. 80

Root is 7; left and right subtrees have 3 nodes each: C(6,3) · h(3)² where h(3) = 2, giving 20 · 4 = 80.

More Programming and Data Structures (GATE) questions

Exams that ask this topic