30 template<
typename val_t>
58 void push(
const double &key,
const val_t &val) {
64 while (key >
arr[p >> 1].key) {
val_t & top() const
ref to the top element
Definition: maxheap.h:89
size_t arrsize
Definition: maxheap.h:105
val_t val
Definition: maxheap.h:102
MaxHeap(size_t initsize=0)
default constructor
Definition: maxheap.h:36
item * arr
Definition: maxheap.h:104
item(double key)
Definition: maxheap.h:94
~MaxHeap()
Definition: maxheap.h:41
size_t maxsize
Definition: maxheap.h:105
void pop()
remove the element on the top of the heap, i.e.
Definition: maxheap.h:72
item(double key, val_t val)
Definition: maxheap.h:97
size_t get_size() const
return numebr of items stored in the heap
Definition: maxheap.h:51
double key
Definition: maxheap.h:101
bool is_notempty() const
return true if heap is empty
Definition: maxheap.h:46
void push(const double &key, const val_t &val)
push a new element in the heap and resize the data structure if it is full
Definition: maxheap.h:58