Package org.basex.util
Class MinHeap<K,V>
java.lang.Object
org.basex.util.MinHeap<K,V>
- Type Parameters:
K- key typeV- value type
A min-heap.
- Author:
- BaseX Team 2005-21, BSD License, Leo Woerteler
-
Constructor Summary
ConstructorsConstructorDescriptionMinHeap(Comparator<K> comp) Constructs a heap with the given initial capacity and order. -
Method Summary
-
Constructor Details
-
MinHeap
Constructs a heap with the given initial capacity and order.- Parameters:
comp- comparator
-
-
Method Details
-
insert
Inserts the given key/value pair into the heap.- Parameters:
key- keyvalue- value
-
removeMin
Removes the minimum from this heap.- Returns:
- the removed entry's value
-
size
public int size()Size of this heap.- Returns:
- number of entries
-
isEmpty
public boolean isEmpty()Checks if this heap is empty.- Returns:
trueif heap is empty,falseotherwise
-
toString
-