快速排序
int Divide(int * array,int s,int t){
int x = array[s];
int low = s ,high = t;
while(low < high)
{
while(low < high && array[high] >= x) high--;
if(low < high)
{
array[low] = array[high];
low++;
}
while(low < high && array[low] < x) low++;
if(low < high)
{
array[high] = array[low];
high--;
}
array[low] = x;
return low;
}
上面是快速排序算法的部分程序代码,如果输入的有两位数和一位数,在输出时一位数的顺序老是不对.