1,100 views
0 0 votes
In Quick sort of the following numbers, if the pivot is chosen as the first element, what will be the order of the numbers after the use of partition function ? Assume we are sorting in increasing order. 11, 15, 9, 13, 17, 7, 5, 12, 6, 18

1 Answer

0 0 votes
After $1^{st}$  time partition algo  –  $(6,9,7,5,)11,(15,13,12,17,18)$

$2^{nd} $    time  – $5,6,7,9,11,(15,13,12,17,18)$

$3^{rd} $     time – $5,6,7,9,11,12,13,15,17,18$
Position:
Show:

Related questions

1 1 vote
1 1 answer
147
147 views
GO Classes asked Aug 10
147 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
164
164 views
GO Classes asked Aug 8
164 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
343
343 views
GO Classes asked Aug 6
343 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
191
191 views
GO Classes asked Aug 6
191 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...