/** * Sort the elements of sequence S in nondecreasing order according * to comparator c, using the quick-sort algorithm. Most of the work * is done by the auxiliary recursive method quickSortStep. **/ public static void quickSort (Sequence S, Comparator c) { if (S.size() < 2) return; // a sequence with 0 or 1 element is already sorted quickSortStep(S, c, 0, S.size()-1); // recursive sort method }