pmp-library  1.0
Heap< HeapEntry, HeapInterface > Class Template Reference

A class implementing a heap. More...

#include <pmp/algorithms/Heap.h>

Inherits vector< HeapEntry >.

Public Member Functions

 Heap ()
 Constructor.
 
 Heap (const HeapInterface &i)
 Construct with a given HeapInterface.
 
 ~Heap ()
 Destructor.
 
void clear ()
 clear the heap
 
bool empty ()
 is heap empty?
 
unsigned int size ()
 returns the size of heap
 
void reserve (unsigned int n)
 reserve space for N entries
 
void reset_heap_position (HeapEntry h)
 reset heap position to -1 (not in heap)
 
bool is_stored (HeapEntry h)
 is an entry in the heap?
 
void insert (HeapEntry h)
 insert the entry h
 
HeapEntry front ()
 get the first entry
 
void pop_front ()
 delete the first entry
 
void remove (HeapEntry h)
 remove an entry
 
void update (HeapEntry h)
 update an entry: change the key and update the position to reestablish the heap property. More...
 
bool check ()
 check heap condition
 

Detailed Description

template<class HeapEntry, class HeapInterface>
class pmp::Heap< HeapEntry, HeapInterface >

A class implementing a heap.

Member Function Documentation

void update ( HeapEntry  h)
inline

update an entry: change the key and update the position to reestablish the heap property.