Package dsa
Class Heap
java.lang.Object
dsa.Heap
This library implements heap 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.
-