/** * Sorts the given array in natural order. This method uses the insertion sort * algorithm. It is only recommended to use this algorithm for partially sorted small arrays! */ public static <T extends Comparable<? super T>> void insertionSort(T[] a) { insertionSort(a, 0, a.length); }
/** * Sorts the given array using the {@link Comparator}. This method uses the insertion sort * algorithm. It is only recommended to use this algorithm for partially sorted small arrays! */ public static <T> void insertionSort(T[] a, Comparator<? super T> comp) { insertionSort(a, 0, a.length, comp); }