2 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. Algorithms algorithms quick-sort time-complexity sorting + – LavTheRawkstar 2.3k views answer comment Share Follow Print See 1 comment 1 1 comment reply lU$er commented Apr 15, 2017 reply Follow flag Possible duplicate of https://gateoverflow.in/125608/a-list-of-elements-are-given-a-3-1-4-1-5-9-2-6-5-3-5-8-9#a125613 0 0 replyShare Please log in or register to add a comment.
Best answer 2 2 votes 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. Purvi Agrawal answered Apr 15, 2017 • selected Apr 15, 2017 by LavTheRawkstar Purvi Agrawal comment Share Follow See all 2 Comments 2 2 Comments reply LavTheRawkstar commented Apr 15, 2017 reply Follow flag respected mam i am also having confusion mam please post your entire solution please 0 0 replyShare Purvi Agrawal commented Apr 15, 2017 reply Follow flag 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 1 replyShare Please log in or register to add a comment.
1 1 vote you can select 2 as pivot element sandeepjkh answered Sep 6, 2017 sandeepjkh comment Share Follow 0 reply Please log in or register to add a comment.
0 0 votes If we take 9 as the pivot element the array remains same bcoz no one is greater than 9 sandeepjkh answered Sep 6, 2017 sandeepjkh comment Share Follow 0 reply Please log in or register to add a comment.