/**
* 递归实现快速排序
* @return
*/
public static void quickSort(int []v, int left, int right){
if(left < right){
int key = v[left];
int low = left;
int high = right;
while(low < high){
while(low < high && v[high] > key){
high--;
}
v[low] = v[high];
while(low < high && v[low] < key){
low++;
}
v[high] = v[low];
}
v[low] = key;
quickSort(v,left,low-1);
quickSort(v,low+1,right);
}
}
递归实现快速排序
最新推荐文章于 2022-11-20 14:33:47 发布