Why mid++,low++ if(a[mid] == 0)
but no mid++, only high-- if(a[mid] == 2) ?
I see we don’t do mid++ if a[mid] == 2, because what if even after swap(a[mid], a[high]) a[mid] is 2.
Then, why do mid++ along with low++ if(a[mid == 0) ?
I guess it’s because it never happens that even after swap(a[mid], a[low]) a[mid] is 0. But, how can we be sure that this actually never happens?