public abstract class Sorter
extends java.lang.Object
| Constructor and Description |
|---|
Sorter() |
| Modifier and Type | Method and Description |
|---|---|
static <E extends java.lang.Comparable<E>> |
isSorted(E[] array)
Tells whether or not an array is sorted.
|
static java.lang.Integer[] |
makeArray(int size)
Makes an array of Integers for testing.
|
abstract <E extends java.lang.Comparable<E>> |
sort(E[] array)
Do the actual sorting.
|
int |
timeSort(int size)
Times a sort of an array of a particular size.
|
public abstract <E extends java.lang.Comparable<E>> void sort(E[] array)
array - the array to sortpublic static final <E extends java.lang.Comparable<E>> boolean isSorted(E[] array)
array - the array that may be sortedpublic static final java.lang.Integer[] makeArray(int size)
size - the number of elements in the new arraypublic final int timeSort(int size)
makeArray(). It then returns the number of milliseconds
the sort took, not including time taken to allocate the array
and its components. It will print a warning to stderr if the
array was not properly sorted.size - the number of elements to be sortedmakeArray(int)