@Test public void testShouldCreateHeap() throws Exception { ArrayBinaryHeap<Integer> heap = newIntArrayBinaryHeap(2); heap.add(6); heap.add(2); heap.add(9); heap.add(11); heap.add(0); heap.add(4); heap.add(11); assertHeapIsCorrect(heap); }
void add(@Nonnull T value) { array[lastIndex + 1] = value; bubbleUp(lastIndex + 1); lastIndex++; }
ArrayBinaryHeap { void add(@Nonnull T value) { array[lastIndex + 1] = value; bubbleUp(lastIndex + 1); lastIndex++; } }
ArrayBinaryHeap { void add(@Nonnull T value) { array[lastIndex + 1] = value; bubbleUp(lastIndex + 1); lastIndex++; } private  ArrayBinaryHeap(int height, @Nonnull Comparator<T> comparator);   ArrayBinaryHeap(@Nonnull T[] array, @Nonnull Comparator<T> comparator); }
ArrayBinaryHeap { void add(@Nonnull T value) { array[lastIndex + 1] = value; bubbleUp(lastIndex + 1); lastIndex++; } 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 { void add(@Nonnull T value) { array[lastIndex + 1] = value; bubbleUp(lastIndex + 1); lastIndex++; } 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);  }