The Gateway to Computer Science Excellence
+2 votes
249 views
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.7k points) | 249 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
0
respected mam i am also having confusion mam please post your entire solution please
+1
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,647 questions
56,492 answers
195,439 comments
100,709 users