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
0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
error: <b>Alert: </b>Content selection is disabled!!