|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractCollection
common.FibHeap
public class FibHeap
A Fibonacci heap data structure, as described in Chapter 20 of Cormen, Leiserson, Rivest & Stein (2001).
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface common.Heap |
---|
Heap.Entry |
Constructor Summary | |
---|---|
FibHeap()
Creates a new, empty Fibonnaci heap. |
Method Summary | |
---|---|
Heap.Entry |
add(java.lang.Object o,
double cost)
Adds an entry to this heap for the given object and cost. |
void |
changeCost(Heap.Entry entry,
double newCost)
Throws an UnsupportedOperationException. |
void |
clear()
|
void |
decreaseCost(Heap.Entry entry,
double newCost)
Decreases the cost for the given entry. |
Heap.Entry |
extractMin()
Returns the minimum-cost entry in this heap and removes it from the heap. |
boolean |
isEmpty()
|
java.util.Iterator |
iterator()
Returns an iterator over the Heap.Entry objects in this heap. |
static void |
main(java.lang.String[] args)
Test program. |
Heap.Entry |
peekMin()
Returns the minimum-cost entry in this heap, without modifying the heap. |
int |
size()
|
Methods inherited from class java.util.AbstractCollection |
---|
add, addAll, contains, containsAll, remove, removeAll, retainAll, toArray, toArray, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Collection |
---|
add, addAll, contains, containsAll, equals, hashCode, remove, removeAll, retainAll, toArray, toArray |
Constructor Detail |
---|
public FibHeap()
Method Detail |
---|
public int size()
size
in interface java.util.Collection
size
in class java.util.AbstractCollection
public boolean isEmpty()
isEmpty
in interface java.util.Collection
isEmpty
in class java.util.AbstractCollection
public void clear()
clear
in interface java.util.Collection
clear
in class java.util.AbstractCollection
public java.util.Iterator iterator()
iterator
in interface java.lang.Iterable
iterator
in interface java.util.Collection
iterator
in class java.util.AbstractCollection
public Heap.Entry peekMin()
Heap
peekMin
in interface Heap
public Heap.Entry extractMin()
Heap
extractMin
in interface Heap
public Heap.Entry add(java.lang.Object o, double cost)
Heap
add
in interface Heap
public void decreaseCost(Heap.Entry entry, double newCost)
Warning: If the new cost is greater than the current one, this method will not produce an error message, but the heap may behave incorrectly.
decreaseCost
in interface Heap
public void changeCost(Heap.Entry entry, double newCost)
changeCost
in interface Heap
public static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |