快速排序

public void quickSort(int[] array,int front, int last) {
        if (front >last ) return ;
        int target = array[front];
        int i = front;
        int j = last;
        while (i < j) {
            while (array[j] >= target && i < j) {
                j--;
            }
            while (array[i] <= target && i < j) {
                i++;
            }
            if (i < j) {
                int temp = array[i];
                array[i] = array[j];
                array[j] = temp;
            }
        }
        array[front] = array[i];
        array[i] = target;

        quickSort(array,front, i-1);
        quickSort(array, i+1,last);
    }
点赞