530 views

3 Answers

2 votes
2 votes
if you have extra space you can go for merge sort. else you should have to remain happy with the heap sort . intuitively if you see, if an array is sorted  we are  to swap/assign a lot in merge sort but that's not the case in heap sort.you call heapify(A,i) you are not going to swap once also .

 

so better go for heap sort.....
1 votes
1 votes
MergerSort is better because for larger datasets, mergesort works faster and is stable. Also it can be parallelized. As for Heapsort , sorting is not stable also there is a overhead of maintaining heap.
0 votes
0 votes

Merge sort is better

Reason- it always have same complexity irrespective of input , so easier to analyse. While that is not the case in heap sort.

Related questions

1 votes
1 votes
1 answer
1
Rajesh Pradhan asked Feb 22, 2016
428 views
What is digital signature? How does it work?
1 votes
1 votes
1 answer
2
Rajesh Pradhan asked Feb 22, 2016
607 views
Have you heard of ethernet?” I said “Yes!”. Then I was asked “Can we lay an ethernet LAN between Delhi and Bangalore?
1 votes
1 votes
1 answer
3
Rajesh Pradhan asked Feb 22, 2016
356 views
Which is greater root(n) or 2^root(logn)
0 votes
0 votes
0 answers
4
sonucse12345 asked May 29, 2023
94 views
please anyone share iit patna self sponsored interview experience for artificial intelligence mtech 2022 ?