public interface DoubleIntegerHeap
Modifier and Type | Interface and Description |
---|---|
static interface |
DoubleIntegerHeap.UnsortedIter
Unsorted iterator - in heap order.
|
Modifier and Type | Method and Description |
---|---|
void |
add(double key,
int val)
Add a key-value pair to the heap
|
void |
add(double key,
int val,
int k)
Add a key-value pair to the heap if it improves the top.
|
void |
clear()
Clear the heap contents.
|
boolean |
isEmpty()
Is the heap empty?
|
double |
peekKey()
Get the current top key
|
int |
peekValue()
Get the current top value
|
void |
poll()
Remove the first element
|
void |
replaceTopElement(double key,
int val)
Combined operation that removes the top element, and inserts a new element
instead.
|
int |
size()
Query the size
|
DoubleIntegerHeap.UnsortedIter |
unsortedIter()
Get an unsorted iterator to inspect the heap.
|
void add(double key, int val)
key
- Keyval
- Valuevoid add(double key, int val, int k)
key
- Keyval
- Valuek
- Desired maximum sizevoid replaceTopElement(double key, int val)
key
- Key of new elementval
- Value of new elementdouble peekKey()
int peekValue()
void poll()
void clear()
int size()
boolean isEmpty()
true
when the size is 0.DoubleIntegerHeap.UnsortedIter unsortedIter()