Time complexity of Normal Quick Sort in worst case is O(n^2) when one of the following 2 cases occur:
- Input is already sorted either in increasing or decreasing order
- All elements in input array are same
In above two mentioned cases, PARTITION algorithms will divide array into two sub-parts, one with (n-1) elements and second with 0 elements
To avoid this bad case, we use another version of QuickSort i.e Randomized Quick-Sort, in which an random element is selected as pivot. The expected T.C of randomized quick-sort is theta(nlogn).
My question is, for what input/case, randmized Quick-Sort will result into worst time complexity of O(n^2)?