I'm struggling with quicksort in Knking example.
int split(int a[], int low, int high)
{
int part_element = a[low];
for(;;)
{
while(low < high && part_element <= a[high])
high--;
if(low >= high)
break;
a[low++] = a[high];
while(low < high && a[low] <= part_element)
low++;
if(low >= high)
break;
a[high--] = a[low];
}
a[high] = part_element;
return high;
}
I wonder why the condition if(low >= high) has >.
evertime high gets smaller and low gets bigger they sometime be the same.
why the book included the > in the condition?
I think it is enough with if(low == high).
In which situation low can be bigger than high?