reshown by
1,103 views
1 votes
1 votes
After applying few passes of quick sort on a given array,  the following output was obtained:

1,10,5,8,25,44,55,30,70

Then how many pivot elements are there in the above output?
reshown by

1 Answer

1 votes
1 votes
There should be 3 pivot elements.

Property of output of each pass of Quicksort ->

1. The pivot elements is on its correct position.

2. All the elements on the left of pivot are smaller than it and elements on the right are greater than it.

So in the given question ->

1, 25 , 70 are pivot elements hence no of pivot elements are 3.

Related questions

0 votes
0 votes
1 answer
2
Gate Fever asked Dec 16, 2018
1,150 views
The median of n elements can be found in O(logn) time.which one of the following is correct about worst case time complexity of quick sort,if always median is selected a...
0 votes
0 votes
2 answers
3