GATE Papers >> CSE >> 2015 >> Question No 230

Question No. 230 CSE | GATE 2015

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


Answer : (D) 3


Solution of Question No 230 of GATE 2015 CSE Paper

Array:

0 1 2 3 4 5 6 7 8 9 10 11 12
89 19 50 17 12 15  2   5   7  11 6 9 100

1st interchange : 100 & 15 (A[12] & A[5])

⇒ 2nd interchange : 100 % 50 (A[5] & A[27])

⇒ 3rd interchange  : 100 & 89 (A[2] & A[0])

Maxheap Array:

100 19 89 17 12 50  2  5  7 11 6 9 15
0 1 2 3 4 5 6 7 8 9 10 11 12
Comments
Zg8e03 http://pills2sale.com/ viagra cialis buy

Posted on  01/11/2020 19:22:21  by  johnanx
niJKch https://www.quora.com/What-the-top-SEO-keywords-for-essay-you-know/answer/Alan-Smith-1772 write my essay

Posted on  04/12/2020 00:30:08  by  dobson
XRvtrv http://xnxx.in.net/ xnxx videos

Posted on  12/12/2020 22:48:27  by  johnan
6d3FxO https://writemyessayforme.web.fc2.com/

Posted on  13/12/2020 06:07:22  by  dobson
iO5vMN https://writemyessayforme.web.fc2.com/#writemyessay

Posted on  15/12/2020 07:07:29  by  dobson
sK89oq https://writemyessayforme.web.fc2.com/octavio-paz-essay-day-of-the-dead.html

Posted on  09/01/2021 10:53:56  by  dobson
2GOrrr http://waldorfdollshop.us/ waldorf doll

Posted on  09/01/2021 15:10:22  by  johnanz
wyFGcS https://beeg.x.fc2.com/

Posted on  26/01/2021 16:01:13  by  markus
V4o3hG https://buyzudena.web.fc2.com/

Posted on  27/01/2021 13:40:33  by  markus
Leave a comment