|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object | +--DataStructures.StrictBinaryHeap
Binary heap implementation of a priority queue, in which items of the same priority are removed in order of insertion.
BinaryHeap| Constructor Summary | |
StrictBinaryHeap()
Constructs the binary heap. |
|
| Method Summary | |
void |
add(java.lang.Comparable item)
Adds and item to the heap. |
boolean |
isEmpty()
Tests if the heap is empty. |
java.lang.Comparable |
remove()
Removes an item of highest priority item from the heap. |
int |
size()
Returns the current size of the queue. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public StrictBinaryHeap()
| Method Detail |
public boolean isEmpty()
isEmpty in interface PriorityQueuepublic int size()
size in interface PriorityQueuepublic void add(java.lang.Comparable item)
add in interface PriorityQueueitem - the item to add.public java.lang.Comparable remove()
If several items are currently of highest priority, returns them in order of insertion.
remove in interface PriorityQueueNoSuchElementException - if the heap is empty.
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||