Recent questions tagged sorting

2 votes
1 answer
272
Suppose A is sorted array and some of the elements are duplicates what is the best upper bound to find out the number of elements that are equal to any given key 'k'.
2 votes
0 answers
273
If we are asked to find best comparison based sorting algorithm to sort n numbers having d digit's and in the range from [1-k].If I say it is quick sort or merge sort or ...
0 votes
1 answer
275
In sorted array of size n time required to verify if there exist 2 number a and b such that a+ b = s in worst case Where s is a constant.
3 votes
2 answers
277
Given a 2D array X[m][n] which has m rows and n columns. The array X is row wise and column wise sorted (i.e) each individula row and column is sorted. What is the comple...
4 votes
1 answer
278
True or FalseMerge sort on Linked list takes O(nlogn)
4 votes
4 answers
280
Consider bottom-up merge sort working on 'n' elements. Assume 'n' is a power of 2. The minimum number of comparisons in order to get sorted list is(A) (n log n) / 2(B) n ...
1 votes
1 answer
281
1 votes
1 answer
282
Could anyone describe how the partitioning algorithm vary when the pivot is varied ?In Cormen , last element is taken as pivot . Suppose I took first element or middle e...
1 votes
2 answers
284
1. Is bucket sort always stable or does it depend on the sorting subroutine used by bucket sort toe sort the buckets?2. Bucket sort is always NOT inplace.Is this correct...
1 votes
1 answer
285
3 votes
3 answers
286
"Quick sort has good cache performance" , Can anyone explain this statement.How is cache related to quick sort.I searched for this over the internet but could not find a ...
3 votes
3 answers
288
suppose there are 4 sorted lists of n/4 elements each. if we merge these list into a single sorted list of n elements, for the n=400 number of key comparisons in the wors...
1 votes
1 answer
289
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 sor...
3 votes
1 answer
290
When array is already sorted in reverse order then what will be the recurrence relation for number of swaps on array of n elements using quick sort?
2 votes
2 answers
291
1 votes
1 answer
293
1 votes
1 answer
294
Array of 1 to n^6 , which algorithm can be used to sort in linear time?a) not possibleB)radixc)countingd)quick
1 votes
0 answers
295
will A[i+1]=key; in the insertion sort be counted as a movement in best case?
1 votes
1 answer
296
1 votes
1 answer
297
What is the method to find the time complexity to search an element which appears more than 20% in sorted array having n elements.and also for 1% or 40% .
2 votes
1 answer
299
How to get Time Complexity of finding the number of inversions in an array?
2 votes
1 answer
300