stores map from element id in[0, size) to T; More...
#include <MRHeap.h>
Classes | |
| struct | Element |
Public Member Functions | |
| Heap (size_t size, T def={}, P pred={}) | |
| constructs heap for given number of elements, assigning given default value to each element | |
| Heap (std::vector< Element > elms, P pred={}) | |
| constructs heap from given elements (id's shall not repeat and have spaces, but can be arbitrary shuffled) | |
| size_t | size () const |
| returns the size of the heap | |
| void | resize (size_t size, T def={}) |
| increases the size of the heap by adding elements at the end | |
| const T & | value (I elemId) const |
| returns the value associated with given element | |
| const Element & | top () const |
| returns the element with the largest value | |
| void | setValue (I elemId, const T &newVal) |
| sets new value to given element | |
| void | setLargerValue (I elemId, const T &newVal) |
| sets new value to given element, which shall be larger/smaller than the current value | |
| void | setSmallerValue (I elemId, const T &newVal) |
| template<typename U > | |
| void | increaseValue (I elemId, const U &inc) |
| Element | setTopValue (const T &newVal) |
| sets new value to the current top element, returning its previous value | |
stores map from element id in[0, size) to T;
provides two operations: 1) change the value of any element; 2) find the element with the largest value