2,468 views
0 votes
0 votes

2 Answers

0 votes
0 votes
Actually depends on what is the middle number and the system starts with zero or 1. Considering that the system starts with 1 and middle is 15. There will be one swap and the result will be 10,15,25,38,45,60,32,23
0 votes
0 votes
middle element is A[(0+7)/2]=A[3]=15 so for elements less than or equal to 15 swaps will take place in the ist pass .so for 15 and 10 swaps take place hence the no of swaps= 2.after ist pass the array becomes:15,10,25,32,45,60,38,23

Related questions

1 votes
1 votes
0 answers
3
hem chandra joshi asked Dec 2, 2017
3,772 views
What is the number of Comparison to sort below arrays using quick sort using first element as pivot ?Please show steps .A1=4,1,5,3,2A2=1,2,3,4,5
4 votes
4 votes
3 answers
4
Swati verma asked Jun 21, 2017
7,635 views
Time complexity of quick sort when we take pivot from the middle element