GATE CS 2021 Set 2 | Question 12

Programming & Data Structures › Heaps · MCQ · 1 mark · Answer: C

  1. Question 12Programming & Data Structuresmcq1 mark
    Consider a binary min-heap containing distinct elements stored as an array. What is the worst-case time complexity to find the maximum element in the heap?
    • A.
    • B.
    • C.
      ✓
    • D.

    Answer: C

    Solution

    In a min-heap the maximum can be any of the leaves, so all leaves must be examined, requiring time.

More GATE PYQ on Heaps

All GATE CS Programming & Data Structures PYQ →

Attempt GATE CS 2021 Set 2 in real GATE exam mode

Full paper with a timer, the GATE interface and a topic-wise analysis — free.

Create free account →