quicksort algorithm: does it look right?
I have an array of rational numbers and i am write a quicksort algorithm for it. However, the following one, doesn't have any impact on the array. Ideas?
publicvoid quickSort(int low,int high)
{
if (low>=high)return;
Rational pivot=array[high];
int left=low;
int right=high-1;
while (left<right)
{
while ((left><=right) && (array[left].compareTo(pivot)<0))
left++;
while ((left<=right) && (array[right].compareTo(pivot)>0))
right--;
if (left<right) swap(array[right],array[left]);
quickSort(low, left-1);
quickSort(left+1,high);
}
}
>

