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
28
29
|
#include "kPriorityQueue.hpp"
#include <iostream>
int main()
{
kPriorityQueue<char> q(5); // 5 priorities - 0, 1, 2, 3 and 4
q.push('A',0); //adds A with lowest priority: 0
q.push('B',3);
q.push('C',2);
q.pop();
q.push('E',1);
q.push('D',2);
q.push('F',0);
q.push('G',3);
q.push('H',4);
q.pop();
q.push('I',1);
q.push('J',2);
//q.push('F', 5); //error! No such priority!
// GCDJEIAF
for (int i = 0; i < 8; i++)
{
std::cout << q.peek();
q.pop();
}
}
|