173 views

Is there any standard way to sort in Quicksort or what all matters is PIVOT getting placed at its correct position thats it?
I mean if only pivot condition then 3!*3! for both left and right elements but if any standard then each of the left and right parts shall also be preserved in that order so 1?

like in Selection sort we have fixed way that after 1st pass the array will remain as it is and only those elements compared with the minimum will be getting swapped.

edited | 173 views
0
Answer should be 3!*3! = 36.
0
what is the meaning of "the effect of first pass of quicksort algorithm is preserved" ?

by (161 points)
First Pass places the pivot element at the correct position. So after first pass array looks like

[50, 35, 33, 60, 100, 72, 85].

60 is going to be intact at its place.

We can arrange 50, 35, 33 in 3! ways without hurting the information of the first pass, which is all elements before pivot is smaller, similarly for [100, 72, 85].

Thus total ways are 3!*3! = 36.
by (11 points)

–1 vote