public interface Heap<E>
public Heap(Comparator cmp) {}
Modifier and Type | Method and Description |
---|---|
boolean |
add(E o)
Adds the object to the heap.
|
int |
decreaseKey(E o)
Raises the priority of an object in the heap.
|
E |
extractMin()
Returns the minimum object, then removes that object from the heap.
|
boolean |
isEmpty()
Returns true iff the heap is empty.
|
Iterator<E> |
iterator()
Returns an iterator over its elements, in order.
|
E |
min()
Returns the minimum Object in this heap.
|
int |
size()
The number of elements currently in the heap.
|
E extractMin()
E min()
boolean add(E o)
o
- a new elementint size()
boolean isEmpty()
boolean
valueint decreaseKey(E o)
o
should have
changed with respect to the comparator passed in to the heap on
construction. However, it should NOT have changed with respect
to its equals() method. This is unlike the Java SortedSet where
the comparator should be consistent with equals(); here they
should not match.o
- an Object
value which has changed wrt the heap's ordering