@@ -0,0 +1,1504 @@
+package heaps;%0A%0A/**%0A * Interface common to heap data structures.%3Cbr%3E%0A * %3Cp%3EHeaps are tree-like data structures that allow storing elements in a specific%0A * way. Each node corresponds to an element and has one parent node (except for the root) and%0A * at most two children nodes. Every element contains a key, and those keys%0A * indicate how the tree shall be built. For instance, for a min-heap, the key of a node shall%0A * be greater than or equal to its parent's and lower than or equal to its children's (the opposite rule applies to a%0A * max-heap).%3C/p%3E%0A * %3Cp%3EAll heap-related operations (inserting or deleting an element, extracting the min or max) are performed in%0A * O(log n) time.%3C/p%3E%0A * @author Nicolas Renard%0A * %0A * %0A */%0Apublic interface Heap %7B%0A    %0A    /**%0A     * %0A     * @return the top element in the heap, the one with lowest key for min-heap or with%0A     * the highest key for max-heap%0A     * @throws Exception if heap is empty%0A     */%0A    public abstract HeapElement getElement() throws EmptyHeapException;%0A    /**%0A     * Inserts an element in the heap. Adds it to then end and toggle it until it finds its%0A     * right position.%0A     * %0A     * @param element an instance of the HeapElement class.%0A     */%0A    public abstract void insertElement(HeapElement element);%0A    %0A    /**%0A     * Delete an element in the heap.%0A     * %0A     * @param elementIndex int containing the position in the heap of the element to be deleted.%0A     */%0A    public abstract void deleteElement(int elementIndex);%0A%0A%7D%0A

Create Heap.java