public static int pivot(int[] array,int start,int end){
int tmp = array[start];
while(start<end){
while(start < end && array[end] >= tmp){
end–;
}
array[start]=array[end];
//把数据赋值给start
while(start < end && array[end] <= tmp){
start++;
}
//把start下标的值给end
array[start] = tmp;
return start;
}
public static void quick(int[] array,int low,int high){
if(low < high){
int piv = pivot(array,low,high);
qucik(array,low,piv-1);
qucik(array,piv+1,high );
}https://win8.com/
}
public static void quickSort(int[] array){
quick(array,0,array.length-1);
}
数据快速排序
最新推荐文章于 2022-02-14 20:48:55 发布