Data Structures · Question 30 · Hard

A max-heap of 15 distinct keys is stored in array positions 1 to 15. How many of these positions could possibly hold the smallest key?

  1. 15
  2. 8
  3. 7
  4. 1
Answer and explanation

Answer: B. 8

Explanation: In a max-heap every parent is larger than its children, so the smallest key cannot have a child and must be a leaf. Positions 8 to 15 are the leaves, and any of them can hold it, so there are 8 positions.

Previous: The numbers 1, 2, 3, 4, 5 are pushed onto a stack in that order, and pops may…

Practise data structures

Try a fresh set of data structures questions with an explanation after every answer, free and without signing up: Data Structures practice. Or sit a full placement mock test.

More data structures questions

More technical & programming practice

Algorithms · Object-Oriented Programming · DBMS · SQL · Operating Systems · Computer Networks · Software Engineering · Cloud & DevOps

LogicWiz Exams home · All practice topics · Placement mock tests · Daily 10 challenge