retagged by
346 views

1 Answer

Best answer
0 votes
0 votes

The performance depends on which performance measure u r taking..

If we consider complexity as number of comparisions ,  then insertion sort works better than selection sort provided array is nearly sorted.

But if we consider complexity in terms of swaps or memory writes , then no doubt selection sort is better than insertion sort as selection sort takes O(n) swaps in any case but insertion sort may take O(n2) if array is not nearly sorted..

I hope u have got the point here..

selected by

Related questions

1 votes
1 votes
1 answer
1
iarnav asked May 4, 2019
834 views
I’ve seen this wikipedia article – https://en.wikipedia.org/wiki/Comparison_sortAlso see this link – https://gateoverflow.in/32948/minimum-number-of-comparisonshttp...
3 votes
3 votes
3 answers
2
sunil sarode asked Jan 23, 2018
2,912 views
I am not able to get this formula (number of input * number of digit *base of number )I am not getting how base of number is important ?Thanks :)
9 votes
9 votes
2 answers
4
srestha asked Dec 23, 2016
3,449 views
The lower bound on the no. of comparisons required to sort n numbers is __________ ?