i used randomized quicksort algo still getting time limit exceeded…?please take a look…?
Quicksort problem
hey @nikhilmeena instead of shuffling whole array try taking your pivot index as a random value
srand(time(NULL))
pindex=S+rand()%(E-S+1);
pivot=arr[pindex];
swap(arr[pindex],arr[E]);
try this it may work.
still time limit issue is occuring i’ve tried the random pivot as well as also tried shuffling the whole array…?
hey @nikhilmeena in your code when you are writing the function quicksort(arr,0,index-1) in the line 41 it should be quicksort(arr,s,index-1),update this and your code will work fine,if still get any problem inform me else mark this doubt as resolved , thankyou.
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.