retagged by
449 views

1 Answer

0 votes
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!

Related questions

2.0k
views
3 answers
3 votes
srestha asked May 12, 2019
2,009 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 ... not will it be answer?? How do we know it is asking for almost sorted array??
494
views
1 answers
0 votes
srestha asked May 6, 2019
494 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 number ... $\left ( 5000 \right )\times 4$. Someone check plz
881
views
1 answers
1 votes
srestha asked Apr 28, 2019
881 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$ ... but answer given as $O(log n).$Please help me out, which will be correct answer?
2.2k
views
5 answers
1 votes
hitesh159 asked Apr 16, 2019
2,215 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?