Quick Sort time exceed?

Quick sort is a predefined algo. I have implemented the logic similarly to the algo but 1 test case is failing due to time limit exceed. Why ??

this tle is coming because you are always making the first element as the pivot…in worst case the complexity of quick sort is n^2…try making any random element as the pivot…(Randomized QuickSort)…

1 Like

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.