@Test public void testHeapifyShouldProduceCorrectHeap() throws Exception { assertHeapIsCorrect(heapify(generateUniqueIntList(2).toArray(new Integer[2]))); assertHeapIsCorrect(heapify(generateUniqueIntList(3).toArray(new Integer[3]))); assertHeapIsCorrect(heapify(generateUniqueIntList(4).toArray(new Integer[4]))); assertHeapIsCorrect(heapify(generateUniqueIntList(5).toArray(new Integer[5]))); assertHeapIsCorrect(heapify(generateUniqueIntList(6).toArray(new Integer[6]))); assertHeapIsCorrect(heapify(generateUniqueIntList(7).toArray(new Integer[7]))); assertHeapIsCorrect(heapify(generateUniqueIntList(8).toArray(new Integer[8]))); assertHeapIsCorrect(heapify(generateUniqueIntList(100).toArray(new Integer[100]))); }
@Nonnull static <T extends Comparable<T>> ArrayBinaryHeap<T> heapify(@Nonnull T[] array) { return heapify(array, Collections.<T>naturalComparator()); }
ArrayBinaryHeap { @Nonnull static <T extends Comparable<T>> ArrayBinaryHeap<T> heapify(@Nonnull T[] array) { return heapify(array, Collections.<T>naturalComparator()); } }
ArrayBinaryHeap { @Nonnull static <T extends Comparable<T>> ArrayBinaryHeap<T> heapify(@Nonnull T[] array) { return heapify(array, Collections.<T>naturalComparator()); } private  ArrayBinaryHeap(int height, @Nonnull Comparator<T> comparator);   ArrayBinaryHeap(@Nonnull T[] array, @Nonnull Comparator<T> comparator); }
ArrayBinaryHeap { @Nonnull static <T extends Comparable<T>> ArrayBinaryHeap<T> heapify(@Nonnull T[] array) { return heapify(array, Collections.<T>naturalComparator()); } private  ArrayBinaryHeap(int height, @Nonnull Comparator<T> comparator);   ArrayBinaryHeap(@Nonnull T[] array, @Nonnull Comparator<T> comparator); @Nonnull T getRoot(); int getRootIndex(); int getSize(); boolean isValidIndex(int index); static void heapSort(@Nonnull T[] a, @Nonnull Comparator<? super T> c); }
ArrayBinaryHeap { @Nonnull static <T extends Comparable<T>> ArrayBinaryHeap<T> heapify(@Nonnull T[] array) { return heapify(array, Collections.<T>naturalComparator()); } private  ArrayBinaryHeap(int height, @Nonnull Comparator<T> comparator);   ArrayBinaryHeap(@Nonnull T[] array, @Nonnull Comparator<T> comparator); @Nonnull T getRoot(); int getRootIndex(); int getSize(); boolean isValidIndex(int index); static void heapSort(@Nonnull T[] a, @Nonnull Comparator<? super T> c);  }