StreakPeaked· Practice

ExamsGATETechnical

An array [82, 101, 90, 11, 111, 75, 33, 131, 44, 93] is heapified. Which one of the following options represents the first three elements in the heapified array?

  1. 82, 90, 101
  2. 82, 11, 93
  3. 131, 11, 93
  4. 131, 111, 90

Correct answer: 131, 111, 90

Solution

In a max heap, the largest element is at the root, followed by its children, which must also be larger than their own children. After heapifying the given array, the largest value, 131, becomes the root, followed by 111 and 90, which are the next largest elements, thus forming the first three elements of the heap.

Related GATE Technical questions

⚔️ Practice GATE Technical free + battle 1v1 →