Skip to content
Related Articles

Related Articles

Improve Article

GATE | GATE CS 1996 | Question 36

  • Last Updated : 19 Feb, 2021

The minimum number of interchanges needed to convert the array 89, 19, 40, 17, 12, 10, 2, 5, 7, 11, 6, 9, 70 into a heap with the maximum element at the root is
(A) 0
(B) 1
(C) 2
(D) 3

Answer: (C)

Explanation: In these kind of questions we have to make the structure of heap and then try to apply heapify operation in a bottom up fashion and counting number of swaps done in the above question 70 will go up the heap structure 2 times.

Quiz of this Question

Attention reader! Don’t stop learning now.  Practice GATE exam well before the actual exam with the subject-wise and overall quizzes available in GATE Test Series Course.

Learn all GATE CS concepts with Free Live Classes on our youtube channel.

My Personal Notes arrow_drop_up
Recommended Articles
Page :