Computer-Networks
January 1, 2024Number-Systems
January 2, 2024Question 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.

→ Swap 100 & 15

→ Swap 100 & 50

→ Swap 89 & 100

∴ Total 3 interchanges are needed.
4
5
2
3
Subscribe
Login
0 Comments