retagged by
252 views
1 votes
1 votes

What could be the best algorithm from the following when the time complexity is measured based bon the number of swaps performed by the sorting algorithm?

1. Selection sort

2.  Insertion sort

3. Bubble sort

4. None of these

retagged by

1 Answer

1 votes
1 votes
selection sort max n-1 swap

insertion sort max n(n-1)/2 swap

bubble sort max n*(n-1)/2 swap

Related questions

4 votes
4 votes
3 answers
1
kallu singh asked Jan 20, 2018
472 views
1 votes
1 votes
1 answer
2
kallu singh asked Aug 13, 2017
445 views
In the following C function, let n >= m.int gcd(n,m) { if (n%m ==0) return m; n = n%m; return gcd(m,n); }How many recursive calls are made by this function? (A) (logn)?(B...
0 votes
0 votes
1 answer
3
1 votes
1 votes
1 answer
4