int[] a = {3,2,5,4,6,7,8,9,2,0,5,3,1,6,7,8,4,3};
//按从小到大排序
public static void quickSort(int[] a, int start, int end) {
if (start < end) {
int i = start, j = end;
int temp = a[start];
while (i < j) {
while (i < j && a[j] >= temp) {
j--;
}
a[i] = a[j];
while (i < j && a[i] <= temp) {
i++;
}
a[j] = a[i];
}
a[i] = temp; //到这里说明i==j,所以无论用a[i]或者a[j]都是一样的
quickSort(a, start, i - 1);
quickSort(a, i + 1, end);
}
}