In the above code, in line number 26 , we used
quicksort (a, 0 , p-1) ;
instead of this why can’t we use
quicksort (a, s, p-1) ;
In the above code, in line number 26 , we used
quicksort (a, 0 , p-1) ;
instead of this why can’t we use
quicksort (a, s, p-1) ;
hi so if u think logically writing both 0 or s are not same as value of start will change during recursive calls …s would be more accurate and correct as we are passing the variable s only…
But the code is not satisfying the sample input when we use s.
It is working only when we use 0 . Why is it so ?
This is the sample input
5
3 6 4 1 2
ok… so there was error in ur pivot function… I have corrected ur code… its working fine now https://ide.codingblocks.com/s/610594
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.