GATE CS 2024 Set 1 | Question 43

Programming & Data Structures › Heaps · MCQ · 2 marks · Answer: A

  1. Question 43Programming & Data Structuresmcq2 marks
    A binary min-heap has 105 distinct elements. Let be the array index of the maximum element. The number of possible values of is
    • A.
      53
      ✓
    • B.
      52
    • C.
      27
    • D.
      1

    Answer: A

    Solution

    Answer: (A) 53 In a min-heap the maximum is always a leaf (it cannot have a child smaller than it). For (1-indexed), leaves are the nodes with no children: indices through . That is positions, and the max can be at any of them. So 53 possible values of .

More GATE PYQ on Heaps

All GATE CS Programming & Data Structures PYQ →

Attempt GATE CS 2024 Set 1 in real GATE exam mode

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

Create free account →