|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.jutil.java.collections.BinomialHeap
A BinomialHeap is a Heap that consists of a forest of Binomial Trees.
Most operations are O(log(n)).
Field Summary | |
static java.lang.String |
CVS_REVISION
|
Constructor Summary | |
BinomialHeap(java.util.Comparator comparator)
public behavior pre comparator != null; post getComparator() == comparator; post size() == 0; Initialize a new BinomialHeap with the given comparator. |
|
BinomialHeap(java.util.Comparator comparator,
java.lang.Object element)
public behavior pre comparator != null; pre element != null; post getComparator() == comparator; post nbExplicitOccurrences(element) == 1; post size() == 1; Initialize a new BinomialHeap with the given comparator and element. |
Method Summary | |
void |
add(java.lang.Object value)
See superclass. |
void |
clear()
See superclass |
java.util.Comparator |
getComparator()
See superclass. |
boolean |
isEmpty()
See superclass. |
void |
merge(BinomialHeap heap)
public behavior pre heap != null; post size() == \old(size()) + \old(heap.size()) post (\forall Object element; ; nbExplicitOccurrences(element) == \old(nbExplicitOccurrences(element)) + \old(heap.nbExplicitOccurrences(element))); post (\forall Object element; ; heap.nbExplicitOccurences(element) == 0); |
java.lang.Object |
min()
See superclass. |
int |
nbExplicitOccurrences(java.lang.Object element)
See superclass. |
java.lang.Object |
pop()
See superclass. |
int |
size()
See superclass. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String CVS_REVISION
Constructor Detail |
public BinomialHeap(java.util.Comparator comparator)
comparator
- The comparator that is used to determine the order
of the elements.public BinomialHeap(java.util.Comparator comparator, java.lang.Object element)
comparator
- The comparator that is used to determine the order
of the elements.element
- The initial element in the new BinomialHeap.Method Detail |
public java.util.Comparator getComparator()
See superclass.
getComparator
in interface PriorityQueue
public void add(java.lang.Object value)
See superclass.
O(log(n))
add
in interface PriorityQueue
org.jutil.java.collections.PriorityQueue
element
- The object to be added.public java.lang.Object min()
See superclass.
O(log(n))
min
in interface PriorityQueue
public java.lang.Object pop()
See superclass.
O(log(n))
pop
in interface PriorityQueue
public void merge(BinomialHeap heap)
Add all elements in the given BinomialHeap to this heap and empty that heap.
heap
- The heap of which the elements are to be added to this heap.
O(log((n))
public void clear()
See superclass
clear
in interface PriorityQueue
public boolean isEmpty()
See superclass.
isEmpty
in interface PriorityQueue
public int nbExplicitOccurrences(java.lang.Object element)
See superclass.
O(n)
nbExplicitOccurrences
in interface PriorityQueue
org.jutil.java.collections.PriorityQueue
element
- The object of which the number of explicit occurrences is requested.public int size()
See superclass.
size
in interface PriorityQueue
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |