code : https://ide.codingblocks.com/s/210791
one test case not passing… showing time limit
can you tell how it is different from normal quick sort…
do i have to change whole code?
@chaman9
Using random pivoting we improve the expected or average time complexity to O (N log N). The Worst Case complexity is still O ( N^2 ).
pls refer this-> https://www.geeksforgeeks.org/quicksort-using-random-pivoting/
i replaced ll pivot=arr[e]; with this
srand(time(NULL));
ll temp = s + rand() % (e - s+1);
ll pivot=arr[temp];
swap(arr[temp], arr[e]);
and it worked.
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.