Recent questions tagged quick-sort

3 3 votes
1 1 answer
237
237 views
During sorting, one complete processing of all elements whose final positions have not yet been determined is called a pass.Which of the following sequences cannot be the...
1 1 vote
1 1 answer
155
155 views
While sorting the numbers $\text{(70, 48, 76, 58, 43, 47, 78, 53)}$ using quicksort, the last number is chosen as pivot, what will be the permutation of the numbers after...
0 0 votes
1 1 answer
146
146 views
Consider the Quick sort algorithm which sorts elements in ascending order using the first element as pivot. Then which of the following input sequence will require a maxi...
0 0 votes
1 1 answer
169
169 views
The best case behaviour occurs for quick sort is, if partition splits the array of size $n$ into$n/2:(n/2)-1$ $n/2:n/3$ $n/4:3n/2$ $n/4:3n/4$
5 5 votes
1 1 answer
350
350 views
Randomized quicksort is applied to $n$ distinct keys, where $n$ is divisible by $16$.A pivot is chosen uniformly at random.What is the probability that both recursive sub...
3 3 votes
1 1 answer
201
201 views
Consider an array of $2n$ elements of the form:$1,2n-1,2,2n-2,3,2n-3,4,2n-4,\ldots,n,n$For example, when $n=8$:$1,15,2,14,3,13,4,12,5,11,6,10,7,9,8,8$What is the number o...
3 3 votes
1 1 answer
191
191 views
Consider the problem of sorting an array of $n$ comparable elements in which there are only four distinct keys.It is possible to design an algorithm that makes at most $4...
1 1 vote
1 1 answer
168
168 views
Why do $2$-pivot and $3$-pivot quicksort generally perform better than $1$-pivot quicksort?They always perform fewer comparisons. They always perform fewer exchanges. The...
2 2 votes
1 1 answer
150
150 views
In the worst case, approximately how many key comparisons and exchanges does the standard $\texttt{partition()}$ procedure perform on a subarray of length $n$?$\frac{n}{2...
2 2 votes
1 1 answer
190
190 views
The standard $2$-way quicksort partition procedure uses the first element as the pivot and stops both scans when they encounter an element equal to the pivot.It is applie...
4 4 votes
1 1 answer
140
140 views
An array contains $n\geq 8$ distinct elements:$a_1<a_2<\cdots<a_n$The array is sorted using randomized quicksort.What is the probability that $a_7$ and $a_8$ are compared...
0 0 votes
1 1 answer
179
179 views
1. what is the space Complexity of efficient Quick sort algorithem for best case ? in a lecture Reddy Sir Said that it is O(1) is this correct  2.if in the gate exam if t...
0 0 votes
0 0 answers
3
3 views
1.what is the space Complexity of efficient Quick sort algorithem for best case ? in a lecture Reddy Sir Said that it is O(1) is this correct.2. if in the gate exam if th...
4 4 votes
2 2 answers
1.1k
1.1k views
Consider that the quick sort algorithm is used to sort an array of $n$ distinct randomly ordered elements. In every call, the pivot is chosen as the first element of the ...
0 0 votes
1 1 answer
690
690 views
In quick sorting algorithm 2 elements i and j are compared if and only if among all the elements, the element to be picked as pivot is either i or j. Is this statement tr...
14 14 votes
6 answers 6 answers
10.6k
10.6k views
Consider sorting the following array of integers in ascending order using an inplace Quicksort algorithm that uses the last element as the pivot.\begin{array}{|l|l|l|l|l|...
2 2 votes
1 1 answer
870
870 views
Consider the QuickSort algorithm with the last element chosen as the pivot. If the goal is to sort the given array \(a = [30, 40, 50, 60, 70, 80]\) in ascending order, ho...
0 0 votes
1 1 answer
1.1k
1.1k views
13, 60,19,52,45,27,41,30,34,32.. Is this sequence in an array a worst case for Quicksort if first element is choosen as pivot always?I have tried to run algorithm of Quic...
3 3 votes
1 1 answer
2.4k
2.4k views
Which of the following statement(s) is/are true?(a) Quicksort and merge sort are both examples of divide and conquer algorithms.(b) If we randomly choose a pivot element ...
5 5 votes
3 3 answers
1.8k
1.8k views
In QuickSort algorithm, which of the following statements is NOT true regarding the partition process?a) Partition always divides the array into two non-empty subsets.b) ...