Skip to content
GATEiit

GATE CSE 2023 Q12: Which array A[1..10] is a max-heap

Question

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

Try it: multiple choice: exactly one correct option

Select one option
Wrong answer costs 1/3 mark in GATE.
Show answer and explanation

Answer: B (official GATE 2023 final answer key)

Concept used: Max-heap property in an array: A[i]≥A[2i]A[i] \ge A[2i] and A[i]≥A[2i+1]A[i] \ge A[2i+1].

First step: For each option, compare every A[i]A[i] with its children A[2i]A[2i] and A[2i+1]A[2i+1] for i=1,…,5i = 1, \ldots, 5.

Full step-by-step solution

Detailed working, common mistakes and linked mock tests will be available with a free GATEiit account. Log-in is coming soon.

Share this question

WhatsAppDownload image

Source: official GATE 2023 CS question paper and final answer key, organised by IIT Kanpur. Question paper · Answer key