The Gateway to Computer Science Excellence
+2 votes
With quick sort The results after first partioning of the given array.

A = (2,8,7,1,3,5,6,4,9).

Analysis the time complexity of Quick sort in the best case.
in Algorithms by Active (3.8k points) | 258 views

3 Answers

+2 votes
Best answer
After the first pass,I think we would get the same array because 9 is the pivot element and all the no.s before it are smaller than it.So there wouldn't be any change.
by Active (2.7k points)
selected by
respected mam i am also having confusion mam please post your entire solution please
Plz don't call me ma'am.And for this I referred to the algorithm of quick sort given in Cormen.You once see that and try this.Here pivot is always chosen as the last element so 9 will be the pivot and then all the elements before it are checked.If they are smaller then no change and all the elements here are smaller than 9.So there should not be any change in the array.According to me.
+1 vote

you can select 2 as pivot element

by Active (1.5k points)
0 votes
If we take 9 as the pivot element the array remains same bcoz no one is greater than 9
by Active (1.5k points)

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,737 questions
57,378 answers
105,317 users