596 views
0 votes
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 votes
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$

Related questions

3 votes
3 votes
2 answers
1
dhruba asked Jun 5, 2023
1,036 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) ...
0 votes
0 votes
1 answer
2
dhruba asked Jun 5, 2023
443 views
Consider performing QuickSort on an array of n distinct elements. What is the probability that no comparisons will be made between the smallest and largest element?a. 1/n...
0 votes
0 votes
2 answers
3
Ajink123 asked May 10, 2023
555 views
Sort the following array using quicksort algorithm. [40,11,4,72,17,2,49]
0 votes
0 votes
0 answers
4