530 views
0 votes
0 votes
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 be the best choice for sorting the array A?

A.) quick sort

B.) insertion sort

C.) selection sort

D.) bubble sort

I can’t understand how can insertion sort be better in this case?

Please log in or register to answer this question.

Related questions

243
views
1 answers
1 votes
halfcodeblood asked May 26
243 views
How to approach this type of questions?
273
views
1 answers
1 votes
Emankashyap asked Apr 30
273 views
In quick sort, n numbers the (n/10)th element is selected as pivot using n^2 sortimng time complexity what will be the time complexity of quick sort is.....a)O(nlogn)b)O(n^2)c)O(n^3)d)O(n)
342
views
1 answers
0 votes
Mrityudoot asked Mar 7
342 views
For flag based approach in Bubble sort we can check first by a flag if the list is sorted or not in O(n), and if it is sorted, then no need to sort ... the same concept applicable to selection sort? Why it never comes down from O(n$^2$)?
1.1k
views
1 answers
0 votes
Arjun asked Feb 16
1,093 views
Consider the following sorting algorithms:Bubble sortInsertion sortSelection sortWhich ONE among the following choices of sorting algorithms sorts the numbers in the array $[4,3,2,1,5]$ ... $\text{(ii)}$ and $\text{(iii)}$ only