• retagged by
874 views

1 Answer

0 0 votes

If array is nearly sorted then insertion sort will perform better, but in case of bubble sort every two adjacent elements are compared.
I think, both S1 and S2 are correct!

Position:
Show:

Related questions

3 3 votes
3 3 answers
3.1k
3.1k views
srestha asked May 12, 2019
3,147 views
An array $A$ of size n is known to be sorted except for the first $k$ elements and the last $k$ elements, where $k$ is a constant. Which of the following algorithms will ...
1 1 vote
1 answers 1 answer
942
942 views
srestha asked May 6, 2019
942 views
Through an experiment, it is found that selection sort performs $5000$ comparisons when sorting an array of size $k.$ If the size of array is doubled, what will be the nu...
1 1 vote
1 1 answer
1.8k
1.8k views
srestha asked Apr 28, 2019
1,814 views
Given a sorted array of distinct integer $A\left [ 1,2,....n \right ]$, the tightest upper bound to check the existence of any index $i$, for which $A[i]=i$ is equal to _...
1 1 vote
5 5 answers
4.1k
4.1k views
hitesh159 asked Apr 16, 2019
4,086 views
why not merge sort?we don’t swap in merge sort,we just create auxillary arrays and merge them by changing elements in the original array.should we consider that as a swap...