快速排序算法
void quickSort (int[] arr, int start,int end){
if (start < end){
int pivotIndex = partition(arr,start,end);
quickSort(arr,start,pivotIndex - 1);
quickSort(arr,pivotIndex + 1, end);
}
}
private int partition(int [] arr, int start, int end){
int pivot = arr[start];
int left = start;
int right = end;
while (left < right){
while (left < right && arr[right] >=pivot) right --;
while (left < right && arr[left] <= pivot) left ++;
if (left >= right) break;
arr[left] = arr[left] + arr[right] - (arr[right] = arr[left]);
}
arr[start] = arr[left];
arr[left] = pivot;
return left;
}