/** * Base abstract class for Sorters of various kinds. * * @author Adam Smith * @version 1.0 */ public abstract class Sorter { /** * Do the actual sorting. This method should be overridden. * * @param array the array to sort */ abstract public > void sort(E[] array); /** * Tells whether or not an array is sorted. Useful for * assertions. Will also return false if one of the elements is * null. * * @param array the array that may be sorted * @return whether or not it's sorted */ public static final > boolean isSorted(E[] array) { if (array[0] == null) return false; // go thru each element, testing for order for (int i=1; i> int hashSort(E[] array) { int hash = 0; for (int i=0; i