13, 60,19,52,45,27,41,30,34,32.. Is this sequence in an array a worst case for Quicksort if first element is choosen as pivot always?
I have tried to run algorithm of Quicksort on this sequence but not getting it.. Can anyone please explain this?
My approach is::
After 1st iteration array is splitted into(pivot is 13):
sub-array1:: null
subarray 2:: 60,19,52,45,27,41,30,34,32
applying quicksort on subarray 2:
After 2nd iteration sub-array 2 is splitted into(pivot is 60):
sub-array 21:: 32,19,52,45,27,41,30,34
sub-array 22:: 60
applying quicksort on subarray 22(pivot is 32):
After 3rd iteration sub-array 22 is splitted into:
sub-array 221:: 30,19,27
sub-array 223:: 52,41,45,34
and seeing this iteration 3 we can say this is not a worst case hence for whole array it would not be a worst of if sorting using Quicksort..
Can someone please tell me where I am thinking wrong??