-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPriorityQueue.cpp
More file actions
39 lines (30 loc) · 813 Bytes
/
PriorityQueue.cpp
File metadata and controls
39 lines (30 loc) · 813 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
28
29
30
31
32
33
34
35
36
37
38
39
/*
* Title: Heaps, Priority Queues
* Author: Berk Temel
* ID: 22002675
* Section: 2
* Assignment: 3
* Description: Implementation of PriorityQueue class, from lecture slides
*/
#include "PriorityQueue.h"
bool PriorityQueue::pqIsEmpty() const {
return h.heapIsEmpty();
}
void PriorityQueue::pqInsert(const KeyedItem &newItem) {
if(h.heapFull())
cout << "Priority Queue is full" << endl;
else
h.heapInsert(newItem);
}
void PriorityQueue::pqDelete(KeyedItem &priorityItem) {
if(h.heapIsEmpty())
cout << "Priority Queue is empty" << endl;
else
h.heapDelete(priorityItem);
}
void PriorityQueue::pqPeek(KeyedItem &topItem) {
h.heapPeek(topItem);
}
void PriorityQueue::pqChange(int time) {
h.heapChange(time);
}