Package dsa
Class Quick3way
java.lang.Object
dsa.Quick3way
This library implements quick-3-way sort.
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
Unit tests the library.static void
sort
(double[] a) Sorts the arraya
.static void
sort
(int[] a) Sorts the arraya
.static <T extends Comparable<T>>
voidsort
(T[] a) Sorts the arraya
according to the natural order of its items.static <T> void
sort
(T[] a, Comparator<T> c) Sorts the arraya
according to the order induced by the comparatorc
.
-
Method Details
-
sort
Sorts the arraya
according to the natural order of its items.- Type Parameters:
T
- the type of items in a.- Parameters:
a
- the array to sort.
-
sort
Sorts the arraya
according to the order induced by the comparatorc
.- Type Parameters:
T
- the type of items in a.- Parameters:
a
- the array to sort.c
- the comparator to determine the order of the array.
-
sort
public static void sort(int[] a) Sorts the arraya
.- Parameters:
a
- the array to sort.
-
sort
public static void sort(double[] a) Sorts the arraya
.- Parameters:
a
- the array to sort.
-
main
Unit tests the library.- Parameters:
args
- the command-line arguments.
-