Skip to content
GATEiit

GATE CSE 2021 Set 2 Q12: Finding the maximum element in a binary min-heap

Question

Let HH be a binary min-heap consisting of nn elements implemented as an array. What is the worst case time complexity of an optimal algorithm to find the maximum element in HH?

Try it: multiple choice: exactly one correct option

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

Answer: C (official GATE 2021 final answer key)

Concept used: In a min-heap the maximum is at a leaf, and the heap order says nothing about the order among leaves.

First step: Count the leaves of a heap with nn nodes (about n/2n/2); every one of them is a candidate for the maximum.

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 2021 Set 2 CS question paper and final answer key, organised by IIT Bombay. Question paper · Answer key