/**A heap for integers. * Use an array to hold the elements of the Heap. * Each public method should assume that the Heap * satisfies the "heap properties" when called, and * should ensure that this condition is true when the * method returns. * @author Jam Jenkins * @modified by R. A. Wagner */ public class Heap { /**creates a heap with a given maximum capacity * @param maxCapacity the max number of elements * this heap can hold */ public Heap(int maxCapacity) { } /**Adds the value to the heap in O(log n) time. * Returns true if the value was successfully added, * false otherwise. * @param value */ public boolean add(int value) { return false; } /**Determines if the heap has no elements. * @return true if no elements are in the heap, * false otherwise. */ public boolean isEmpty() { return size()==0; } /**Gets the number of elements in this heap. * @return the number of elements */ public int size() { return 0; } /**Removes the value from the heap in O(n) time. * @param value */ public void remove(int value) { } /**Determines if the value is present in the heap * in O(n) time. * @param value the value to search for * @return true if the value is found, false otherwise */ public boolean contains(int value) { return false; } /**Returns the minimum element in O(1) time. * Does not remove any elements. * @return */ public int getMin() { return getRank(1); } /**Returns the ranked element where 1 is the minimum * element rank and n is the maximum element rank. * For rank 1, 2, or 3 this method runs in O(1) time. * For other ranks, it runs in O(n) time. * @param rank * @return */ public int getRank(int rank) { return 0; } /**Removes the minimum element from this heap in * O(log n) time. * @return true if the element can be removed, * false otherwise (in the case the heap is empty) */ public boolean removeMin() { return false; } /**tests the Heap class * @param args not used */ public static void main(String[] args) { } }