|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
PriorityQueue interface. Some priority queues may support a decreaseKey operation, but this is considered an advanced operation. If so, a Position is returned by insert. Note that all "matching" is based on the compareTo method.
Inner Class Summary | |
static interface |
PriorityQueue.Position
The Position interface represents a type that can be used for the decreaseKey operation. |
Method Summary | |
void |
decreaseKey(PriorityQueue.Position p,
java.lang.Comparable newVal)
Change the value of the item stored in the pairing heap. |
java.lang.Comparable |
deleteMin()
Remove the smallest item from the priority queue. |
java.lang.Comparable |
findMin()
Find the smallest item in the priority queue. |
PriorityQueue.Position |
insert(java.lang.Comparable x)
Insert into the priority queue, maintaining heap order. |
boolean |
isEmpty()
Test if the priority queue is logically empty. |
void |
makeEmpty()
Make the priority queue logically empty. |
int |
size()
Returns the size. |
Method Detail |
public PriorityQueue.Position insert(java.lang.Comparable x)
x
- the item to insert.public java.lang.Comparable findMin()
UnderflowException
- if empty.public java.lang.Comparable deleteMin()
UnderflowException
- if empty.public boolean isEmpty()
public void makeEmpty()
public int size()
public void decreaseKey(PriorityQueue.Position p, java.lang.Comparable newVal)
p
- any non-null Position returned by insert.newVal
- the new value, which must be smaller
than the currently stored value.java.lang.IllegalArgumentException
- if p invalid
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |