Scheduler Sim
A CPU Scheduling Algorithm Simulator in C++.
|
A min heap implementation. More...
#include <min_heap.hpp>
Public Member Functions | |
MinHeap (int(*comparator)(const T &a, const T &b)) | |
Construct a new Min Heap object. | |
MinHeap (std::vector< T > &vec, int(*comparator)(const T &a, const T &b)) | |
Construct a new Min Heap object from a vector. | |
~MinHeap ()=default | |
void | printHeap () const |
void | buildHeap () |
void | insert (T element) |
T | extractMin () |
void | decreaseKey (size_t index, T element) |
bool | isEmpty () const |
A min heap implementation.
T | The type of the elements in the heap |
Construct a new Min Heap object.
comparator | The comparator function to be used for comparing elements |
MinHeap< T >::MinHeap | ( | std::vector< T > & | vec, |
int(*)(const T &a, const T &b) | comparator | ||
) |
Construct a new Min Heap object from a vector.
vec | The vector to be converted into a heap |
comparator | The comparator function to be used for comparing elements |
void MinHeap< T >::buildHeap | ( | ) |
void MinHeap< T >::decreaseKey | ( | size_t | index, |
T | element | ||
) |
T MinHeap< T >::extractMin | ( | ) |
void MinHeap< T >::insert | ( | T | element | ) |
bool MinHeap< T >::isEmpty | ( | ) | const |
void MinHeap< T >::printHeap | ( | ) | const |