...
Computer-Networks
January 1, 2024
Number-Systems
January 2, 2024
Computer-Networks
January 1, 2024
Number-Systems
January 2, 2024

Question 8400 – GATE 2015 [Set-3]

Consider the following array of elements. 〈89, 19, 50, 17, 12, 15, 2, 5, 7, 11, 6, 9, 100〉. The minimum number of interchanges needed to convert it into a max-heap is

Correct Answer: D

Question 18 Explanation: 
Let’s first draw heap from the given array,

→ Swap 100 & 15

→ Swap 100 & 50

→ Swap 89 & 100

∴ Total 3 interchanges are needed.
A
4
B
5
C
2
D
3

Leave a Reply

Your email address will not be published. Required fields are marked *