|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object | +--DataStructures.PairHeap
Implements a pairing heap. Supports a decreaseKey operation. Note that all "matching" is based on the compareTo method.
PairNode| Constructor Summary | |
PairHeap()
Construct the pairing heap. |
|
| Method Summary | |
void |
decreaseKey(PairNode p,
Comparable newVal)
Change the value of the item stored in the pairing heap. |
Comparable |
deleteMin()
Remove the smallest item from the priority queue. |
Comparable |
findMin()
Find the smallest item in the priority queue. |
PairNode |
insert(Comparable x)
Insert into the priority queue, and return a PairNode that can be used by decreaseKey. |
boolean |
isEmpty()
Test if the priority queue is logically empty. |
static void |
main(java.lang.String[] args)
|
void |
makeEmpty()
Make the priority queue logically empty. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public PairHeap()
| Method Detail |
public PairNode insert(Comparable x)
x - the item to insert.public Comparable findMin()
public Comparable deleteMin()
public void decreaseKey(PairNode p,
Comparable newVal)
p - any node returned by addItem.newVal - the new value, which must be smaller
than the currently stored value.public boolean isEmpty()
public void makeEmpty()
public static void main(java.lang.String[] args)
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||