Recent questions tagged sorting

1.3k
views
1 answers
4 votes
Consider a new sorting algorithm similar to the BubbleSort algorithm, called RumbleSort. Given an array as input, RumbleSort attempts to sort the array and produces a sorted ... $\mathcal Ο(n^2)$ Which of the above statements is/are true?
3.2k
views
2 answers
3 votes
Consider the following array with 7 elements for insertion sort?25, 15, 30, 9, 99, 20, 26 In how many passes, the given sequence will be sorted? (a) 4 pass ... pass (d) More than 6 passAnswer is 6 passes. Can anyone explain it step by step.
733
views
0 answers
0 votes
What is the extra memory needed for merge sort:1] In case of Iterative merge sort.(DS:Array)2]In case of Recursive merge sort.(DS:Array)3] In case of Iterative merge sort.(DS:Linked List)4]In case of Recursive merge sort.(DS:Linked List)
1.6k
views
4 answers
3 votes
Consider a scenario of modified quick sort, where we have given an input sorted array A[1 .. . n], all elements of array are distinct and n >=3. Pivot is the median of set of 3 ... sort?a.O($n^{2}$)b.O(nlogn)c.O($n^{2}$logn)d.O(nloglogn)
731
views
1 answers
1 votes
The average no. of comparisons performed by the merge sort algorithm, in merging 2 sorted lists of length 2 is___________.Ans: $\frac{8}{3}$
406
views
1 answers
0 votes
When relative ordering of equal keys is preserved after sorting then it is called stable. Quick sort and heap sort is not a stable sorting algorithm . Doubt---IS Selection sort not a stable sorting algorithm ?
949
views
1 answers
2 votes
we are given (log m) sorted list each of size (log n) / (log m) the time complexity of merging list into single sorted list using mergesort is equal to a) O ( log m log(log n) ) ... ) c) O ( log m log n) d) O ( m log log n)
529
views
0 answers
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 ... sortD.) bubble sortI can't understand how can insertion sort be better in this case?
266
views
2 answers
0 votes
1.1k
views
0 answers
0 votes
Can anyone help me to understand this problem….??
543
views
1 answers
0 votes
Which one of the following algorithms cannot sort $n$ numbers in $O(n)$ comparisons?Counting sortRadix sortHeap sortBucket sort
324
views
1 answers
0 votes
Which of the following is not a stable sorting algorithm in its typical implementation?Merge sortBubble sortQuick sortInsertion sort
1.2k
views
0 answers
0 votes
The second smallest of $n$ elements can be found with ____ comparisons in the worst case.$n-1$\lg \: n$n + ceil(\lg \: n)-2$\frac{3n}{2}$
698
views
0 answers
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 ... the best choice for sorting the array A?a-Insertion Sortb-Bubble sortc-Quicksortd-Selection sort
1.7k
views
1 answers
6 votes
Which of the following sorting algorithms performs efficiently to sort a singly linked list containing $\log n$ ... n ))$\text{Quick sort, } O ( \log 2)(\log n ))$
9.1k
views
1 answers
1 votes
Which of the below given sorting techniques has highest best-case runtime complexity.(A) Quick sort(B) Selection sort(C) Insertion sort(D) Bubble sortAnswer: (B) ... case time should be O(n) sorting method what does highest best cases mean?
848
views
0 answers
0 votes
Please correct if any of the point is wrong :Quicksort:1.Need more random accesses2 Used when Random access is fast (hence preferred on array and not on ... makes it faster than merge sort in many cases like in virtual memory environment.
1.3k
views
1 answers
0 votes
Suppose that the splits at every level of quicksort are in the proportion 1 - α to α, where 0 < α ≤ 1/2 is a constant. Show that ... but couldn't understand https://stackoverflow.com/questions/17684680/maximum-and-minimum-depth-of-quicksort
2.5k
views
4 answers
2 votes
Suppose there are 4 sorted list of 16 elements each. If we merge these lists into a single sorted list of 64 elements. The key comparisons that are needed in the worst case using an efficient algorithm are
659
views
0 answers
0 votes
Which of the following sorting algorithm represented by above code?
5.7k
views
1 answers
2 votes
How many passes of bubble sort are required to sort the following sequence (Pass is counted only when at least one swap is performed in the bubble sort pass)? ... (d) 3I am getting ans as 3 but given answer in 4. please verify it
4.7k
views
1 answers
0 votes
Which of the following input will give best case time for selection sort?(A) 1 2 3 4 5 6 7 8 9 10(B) 2 3 1 5 9 7 8 6 10(C) 10 9 8 7 6 5 4 3 2 1 (D) All of above take same amount of time
894
views
1 answers
2 votes
An array of size n is known to be sorted except for the 1st k elements and the last k elements, where k is a constant. which of the following algorithm is the best ... in average case and O(k^2) in the worst case. what's wrong in that?
339
views
0 answers
0 votes
The tightest lower bound on the number of comparisons, in the worst case, for comparison-based sorting is The tightest upper bound on the number of comparisons ... the number of comparisons, in the best case, for comparison-based sorting is
561
views
0 answers
0 votes
explain how to solve the above question !
17.1k
views
1 answers
1 votes
______ sorting algorithms has the lowest worst-case complexity.Selection SortBubble SortMerge SortQuick Sort
1.2k
views
2 answers
1 votes
The unusual $\Theta(n^2)$ implementation of Insertion Sort to sort an array uses linear search to identify the position where an element is to be inserted ... what the binary search will be performed for every element. Can someone confirm?
5.2k
views
2 answers
1 votes
Is Quick sort an adaptive sorting Algorithm? I think no. Because as per the definition given in the Wikipedia is that A adaptive sorting Algorithm is one who ... preorderedness of the input. But in case of Quick sort it act as disadvantage.