-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPriorityQueue.cpp
More file actions
41 lines (35 loc) · 931 Bytes
/
Copy pathPriorityQueue.cpp
File metadata and controls
41 lines (35 loc) · 931 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
40
41
/*
* PriorityQueue.cpp
*
* Created on: 2016Äê1ÔÂ26ÈÕ
* Author: LeoBrilliant
*/
#include "PriorityQueue.h"
template<typename T, class Container, typename Compare>
inline void PriorityQueue<T, Container, Compare>::GetSummary() {
cout << "Summary[" << endl;
cout << "empty: \t" << (this->Empty()? "True":"False") << "\t" << endl;
cout << "size: \t" << this->Size() << endl;
cout << "]" << endl;
}
template<typename T, class Container, typename Compare>
inline void PriorityQueue<T, Container, Compare>::GetDetail(
const string& s) {
cout << s << endl;
this->GetSummary();
cout << "Elements[" << endl;
priority_queue<T, Container, Compare> tmp;
while(!this->Empty())
{
tmp.push(this->Top());
cout << tmp.Top() << "<->" ;
this->Pop();
}
while(!tmp.empty())
{
//cout << tmp.Top() << "<->" ;
this->Push(tmp.top());
tmp.pop();
}
cout << "]" << endl;
}