|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Interface for a min-priority queue. In classes that implement this interface, the constructor should create an empty min-priority queue.
Method Summary | |
void |
decreaseKey(java.lang.Object element,
java.lang.Comparable newKey)
Decreases the key of a given element to a new value. |
com.mhhe.clrs2e.DynamicSetElement |
extractMin()
Removes and returns the smallest element in the min-priority queue. |
java.lang.Object |
insert(com.mhhe.clrs2e.DynamicSetElement x)
Inserts a dynamic-set element into the min-priority queue. |
boolean |
isEmpty()
Returns true if the min-priority queue is empty,
false if non-empty. |
com.mhhe.clrs2e.DynamicSetElement |
minimum()
Returns the smallest element in the min-priority queue without removing the element. |
Method Detail |
public java.lang.Object insert(com.mhhe.clrs2e.DynamicSetElement x)
x
- The dynamic-set element to be inserted.
decreaseKey(java.lang.Object, java.lang.Comparable)
operation.public com.mhhe.clrs2e.DynamicSetElement minimum()
public com.mhhe.clrs2e.DynamicSetElement extractMin()
In order for the handle of the element returned to be eligible
for garbage collection, the user of the
MinPriorityQueue
should include in a
DynamicSetElement
's satellite data a reference to
the handle. This reference should be set to null
for the element returned by extractMin
.
public void decreaseKey(java.lang.Object element, java.lang.Comparable newKey) throws KeyUpdateException
element
- Handle identifying the element; this handle is
initially given as the return value of insert(com.mhhe.clrs2e.DynamicSetElement)
.newKey
- The new key value for this element.
KeyUpdateException
- if the new key value is greater than
the current key value.public boolean isEmpty()
true
if the min-priority queue is empty,
false
if non-empty.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |