Answer should be 3!*3! = 36.

The Gateway to Computer Science Excellence

0 votes

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.

0 votes

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.

[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.

- All categories
- General Aptitude 1.9k
- Engineering Mathematics 7.5k
- Digital Logic 2.9k
- Programming and DS 4.9k
- Algorithms 4.4k
- Theory of Computation 6.2k
- Compiler Design 2.1k
- Databases 4.1k
- CO and Architecture 3.4k
- Computer Networks 4.2k
- Non GATE 1.4k
- Others 1.4k
- Admissions 595
- Exam Queries 573
- Tier 1 Placement Questions 23
- Job Queries 72
- Projects 18

50,737 questions

57,321 answers

198,399 comments

105,151 users