in DS closed by
4,836 views
2 votes
2 votes
closed as a duplicate of: GATE CSE 2023 | Question: 2

Which one of the following sequences when stored in an array at locations A[1],...,A[10] forms a max-heap?

  1. $23\; 17\; 10\; 6\; 13\; 14\; 1\; 5 \;9 \;12$
  2. $23 \;14 \;19 \;1 \;10 \;13 \;16 \;12 \;7 \;5$
  3. $23 \;17\; 14\; 6\; 13\; 10\; 1\; 5\; 7\; 15$
  4. $23 \;17\; 14\; 7\; 13\; 10\; 1\; 5\; 6\; 12$
in DS closed by
4.8k views

1 Answer

1 vote
1 vote
  • Option (A) is wrong here because node $14$ is comes after $10$.
  • Option (B) is wrong because $16$ comes after node $1$.
  • Option (C) is wrong because $7$ is come after node $6$
  • Option (D) is a correct representation of the max heap which is as follows:

Option (D) is correct.

Ref: some max heap insertion question from pyq:

Answer:

Related questions