in this when we are generating random number by taking mod by (i+1) aren’t we supposed to take mode by i.
Random quicksort
Hello @dishask99,
Yes, it should be rand()%i.
Reason:
initially i=n-1 i.e. the index of last element.
For, that we want to randomly select one position from 0 to i-1.
Hope, this is clear now.
Thanks for pointing out the mistake.