|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.uci.ics.jung.utils.MapBinaryHeap
An array-based binary heap implementation of a priority queue,
which also provides
an efficient update()
operation.
(A previous version of this class had implemented the commons-collections
PriorityQueue interface, which has since been deprecated.)
It contains extra infrastructure (a hash table) to keep track of the
position of each element in the array; thus, if the key value of an element
changes, it may be "resubmitted" to the heap via update
so that the heap can reposition it efficiently, as necessary.
Constructor Summary | |
MapBinaryHeap()
Creates a MapBinaryHeap whose heap ordering
will be based on the natural ordering of the elements,
which must be Comparable . |
|
MapBinaryHeap(java.util.Comparator c)
Creates a MapBinaryHeap whose heap ordering
is based on the ordering of the elements specified by c . |
Method Summary | |
void |
clear()
|
void |
insert(java.lang.Object o)
|
boolean |
isEmpty()
|
java.lang.Object |
peek()
|
java.lang.Object |
pop()
|
int |
size()
Returns the size of this heap. |
void |
update(java.lang.Object o)
Informs the heap that this object's internal key value has been updated, and that its place in the heap may need to be shifted (up or down). |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public MapBinaryHeap(java.util.Comparator c)
MapBinaryHeap
whose heap ordering
is based on the ordering of the elements specified by c
.
public MapBinaryHeap()
MapBinaryHeap
whose heap ordering
will be based on the natural ordering of the elements,
which must be Comparable
.
Method Detail |
public void clear()
PriorityQueue.clear()
public void insert(java.lang.Object o)
PriorityQueue.insert(java.lang.Object)
public boolean isEmpty()
PriorityQueue.isEmpty()
public java.lang.Object peek() throws java.util.NoSuchElementException
java.util.NoSuchElementException
PriorityQueue.peek()
public java.lang.Object pop() throws java.util.NoSuchElementException
java.util.NoSuchElementException
PriorityQueue.pop()
public int size()
public void update(java.lang.Object o)
o
-
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |