0 votes 0 votes Consider the following max-heap as given below : 9 / \ 6 8 / \ / \ 3 4 5 7 The number of swaps required to convert the given max-heap into min-heap is ______. Algorithms tbb-algorithms-2 numerical-answers + – Bikram asked May 26, 2017 • edited Aug 20, 2019 by Counsellor Bikram 381 views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
Best answer 2 votes 2 votes I am getting as 5 swaps 9--6,9--3,8--5,6--3,6--4 swaps.Can you please help how to get 4 chap24 answered Sep 14, 2017 • selected Aug 20, 2019 by Bikram chap24 comment Share Follow See all 5 Comments See all 5 5 Comments reply Show 2 previous comments dswarupa commented Nov 28, 2017 reply Follow Share I think it's 2. Because they've not imposed any restriction on how you swap them. Do the following. swap(9,3) 3 / \ 6 8 / \ / \ 9 4 5 7 swap(4,8) 3 / \ 6 4 / \ / \ 9 8 5 7 1 votes 1 votes chap24 commented Nov 28, 2017 reply Follow Share but the swap should follow an algorithmic approach(heapify) .So it should either bottom up or top down .Can not be arbitrary sequence of swaps across I think 0 votes 0 votes I_am_winner commented Aug 10, 2018 reply Follow Share really twisted question to check concept amazing 0 votes 0 votes Please log in or register to add a comment.