Why was inequality included in the base case?
Why not only the case when (lo == hi) ?
Quick sort : base case
Hi @mananaroramail,
It is to stay on the safer side that for a case the value of lo may be greater than the high therefore in such case the program will end up in a infinite loop so to save program from that we have used inquality.
Yep. I tried it and it gave a STACK OVERFLOW ERROR.
So I started drawing the recursion tree for that and came to the result.
Thanks.
1 Like