/** * Sort a subarray of a source array. The subarray is specified by its start * and end index. * * @param source the int array to be sorted * @param left the start index of the subarray * @param right the end index of the subarray */ public static void quicksort(int[] source, int left, int right) { if (right > left) { int index = partition(source, left, right, right); quicksort(source, left, index - 1); quicksort(source, index + 1, right); } }
/** * Sort a subarray of a source array. The subarray is specified by its start * and end index. * * @param source the int array to be sorted * @param left the start index of the subarray * @param right the end index of the subarray */ public static void quicksort(int[] source, int left, int right) { if (right > left) { int index = partition(source, left, right, right); quicksort(source, left, index - 1); quicksort(source, index + 1, right); } }