-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathPQueueH.h
More file actions
27 lines (20 loc) · 721 Bytes
/
PQueueH.h
File metadata and controls
27 lines (20 loc) · 721 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Priority Queue ADT
// Min-heap implementation
#include <vector>
using namespace std;
class PriorityQueue
{
private:
vector<int> H = {-99999};//dummy value at index 0
// valid indicies are 1 ... 𝑛
public:
void insert(int); // 𝛳 (1)
int deleteMin(); // 𝛳 (?)
int size(); // 𝛳 (1)
void clear(); // 𝛳 (𝑛)
// Technically these are not priority queue methods
// But they are useful to have when using a heap implementation
void heapifyDown(int); // 𝛳 (?)
void heapifyUp(int); // 𝛳 (?)
void buildHeap(); // 𝛳 (?)
};