快速排序

private static void quickSort(int[] a,int left,int right) {
if(left >= right){
return;
}
int priot = a[left];
int _left = left;
int _right = right;
while(left < right) {
while (left < right && a[right] > priot) {
right--;
}
a[left] = a[right];
while (left < right && a[left] < priot) {
left++;
}
a[right] = a[left];
}
a[right] = priot;

    if(_left < _right){
        quickSort(a,_left,left - 1);
        quickSort(a,right + 1, _right);
    }
}

你可能感兴趣的:(快速排序)