in Algorithms edited by
1,084 views
0 votes
0 votes

in Algorithms edited by
1.1k views

2 Answers

0 votes
0 votes
A. insertion sort - gives time complexity of O(n^2)

B. Quick sort - Ads the array is in reversed order, it is worst case for it, so time complexity O(n^2)

C. Merge sort - time complexity is O(nlogn), but takes additional time for unnecessary division.

D. Heap Sort - complexity O(nlogn). (Answer)

4 Comments

@sir plz give a reason???????
0
0
i have read that in best case for heap sort the constant factor for O(n.log n) is less than 1 ....so is it the reason why heap sort is better than merge sort and it also dont require auxillary space. but it is not stable sorting????
0
0
I think the reason is that no stack space is required for recursive calls.
0
0
0 votes
0 votes
Best in terms of complexity :
Time complexity filter out and we have choice of merge and heap sort.
Space complexity selects heap sort as best due to extra space required by merge sort.
So best is Heap sort.

Related questions