1 votes 1 votes Which of the following algorithm gives best performance when items are in reverse order ? a) Merge sort. b) Heap sort. Algorithms algorithms time-complexity merge-sort + – Xylene asked Aug 16, 2017 Xylene 2.0k views answer comment Share Follow See all 11 Comments See all 11 11 Comments reply Show 8 previous comments Shubhanshu commented Aug 17, 2017 reply Follow Share I think they are talking about performance not only TC and in performance SX is also counted and Space compl of merge is O(n) and heap is O(1). 0 votes 0 votes Rishabh Gupta 2 commented Aug 17, 2017 reply Follow Share Yes. that looks a reasonable answer. @Xylene From where you find this question? 0 votes 0 votes Tuhin Dutta commented Dec 13, 2017 reply Follow Share Heapsort is an "inplace" sorting technique so gives better performance w.r.t space complexity but time complexity wise both merge and heap -sort performs same. 1 votes 1 votes Please log in or register to add a comment.
0 votes 0 votes Heap sort. As array is already in reverse order. So we could get advantage of this property while creating heap. Thehimanshukeshi answered Dec 23, 2017 Thehimanshukeshi comment Share Follow See all 0 reply Please log in or register to add a comment.