-
Notifications
You must be signed in to change notification settings - Fork 0
/
PriorityQueue.tpp
36 lines (31 loc) · 1.14 KB
/
PriorityQueue.tpp
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
// Copyright 2019, University of Freiburg,
// Chair of Algorithms and Data Structures.
// Authors: Patrick Brosi <[email protected]>
// _____________________________________________________________________________
template <typename K, typename V>
void PriorityQueue<K, V>::push(K key, const V& val) {
if (key < _last) key = _last;
_pq.emplace(std::pair<K, V>(key, val));
}
// _____________________________________________________________________________
template <typename K, typename V>
const K PriorityQueue<K, V>::topKey() {
_last = _pq.top().first;
return _pq.top().first;
}
// _____________________________________________________________________________
template <typename K, typename V>
const V& PriorityQueue<K, V>::topVal() {
_last = _pq.top().first;
return _pq.top().second;
}
// _____________________________________________________________________________
template <typename K, typename V>
bool PriorityQueue<K, V>::empty() const {
return _pq.empty();
}
// _____________________________________________________________________________
template <typename K, typename V>
void PriorityQueue<K, V>::pop() {
_pq.pop();
}