fix: remove unnecesary throw to fix #704

- Fix #704
- Thanks @lprone
This commit is contained in:
yanglbme
2019-02-06 10:13:55 +08:00
parent bb670a2ceb
commit 8b92c3fdbe
9 changed files with 368 additions and 363 deletions

View File

@ -1,4 +1,4 @@
package heaps;
package Heaps;
/**
* Interface common to heap data structures.<br>
@ -10,32 +10,31 @@ package heaps;
* max-heap).</p>
* <p>All heap-related operations (inserting or deleting an element, extracting the min or max) are performed in
* O(log n) time.</p>
*
* @author Nicolas Renard
*
*
*/
public interface Heap {
/**
*
* @return the top element in the heap, the one with lowest key for min-heap or with
* the highest key for max-heap
* @throws Exception if heap is empty
* @throws EmptyHeapException if heap is empty
*/
public abstract HeapElement getElement() throws EmptyHeapException;
HeapElement getElement() throws EmptyHeapException;
/**
* Inserts an element in the heap. Adds it to then end and toggle it until it finds its
* right position.
*
*
* @param element an instance of the HeapElement class.
*/
public abstract void insertElement(HeapElement element);
void insertElement(HeapElement element);
/**
* Delete an element in the heap.
*
*
* @param elementIndex int containing the position in the heap of the element to be deleted.
*/
public abstract void deleteElement(int elementIndex);
void deleteElement(int elementIndex);
}
}