|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface PriorityQueue<AnyType extends java.lang.Comparable<? super AnyType>>
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.
Nested Class Summary | |
---|---|
static interface |
PriorityQueue.Position<AnyType>
The Position interface represents a type that can be used for the decreaseKey operation. |
Method Summary | |
---|---|
void |
decreaseKey(PriorityQueue.Position<AnyType> p,
AnyType newVal)
Change the value of the item stored in the pairing heap. |
AnyType |
deleteMin()
Remove the smallest item from the priority queue. |
AnyType |
findMin()
Find the smallest item in the priority queue. |
PriorityQueue.Position<AnyType> |
insert(AnyType 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 |
---|
PriorityQueue.Position<AnyType> insert(AnyType x)
x
- the item to insert.
AnyType findMin()
UnderflowException
- if empty.AnyType deleteMin()
UnderflowException
- if empty.boolean isEmpty()
void makeEmpty()
int size()
void decreaseKey(PriorityQueue.Position<AnyType> p, AnyType 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.
java.lang.UnsupportedOperationException
- if appropriate.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |