/** * 快速排序 */ private static void quickSort ( int[] array, int start, int end ) { if (start < end) { int key = array[start]; int i = start; for ( int j = start + 1; j < end + 1; j++ ) { if (key > array[j]) { int temp = array[j]; array[j] = array[i + 1]; array[i + 1] = temp; i++; } } array[start] = array[i]; array[i] = key; quickSort (array, start, i - 1); quickSort (array, i + 1, end); } } |