|
| stack< int, deque< int > > | s |
| |
| priority_queue< int, vector< int >, greater< int > > | q |
| |
Definition at line 5 of file main.cpp.
◆ MinStack()
Definition at line 12 of file main.cpp.
priority_queue< int, vector< int >, greater< int > > q
stack< int, deque< int > > s
◆ getMin()
Definition at line 62 of file main.cpp.
63 {
64 if (
s.empty() ||
q.empty())
65 {
67 throw runtime_error("min-stack.getMin: empty stack");
68 else
69 throw runtime_error("min-stack.getMin: empty priority queue");
70 }
72 }
References q, and s.
◆ pop()
Definition at line 20 of file main.cpp.
21 {
22 if (
s.empty() ||
q.empty())
23 {
25 throw runtime_error("min-stack.pop: empty stack");
26 else
27 throw runtime_error("min-stack.pop: empty priority queue");
28 return;
29 }
31 queue<int> temp;
32 while (!
q.empty() &&
q.top() != el)
33 {
36 }
38 {
40 while (!temp.empty())
41 {
43 temp.pop();
44 }
45 }
47 }
References q, and s.
◆ push()
| void MinStack::push |
( |
int |
val | ) |
|
|
inline |
Definition at line 14 of file main.cpp.
References q, and s.
◆ top()
Definition at line 49 of file main.cpp.
50 {
51 if (
s.empty() ||
q.empty())
52 {
54 throw runtime_error("min-stack.top: empty stack");
55 else
56 throw runtime_error("min-stack.top: empty priority queue");
57 return -1;
58 }
60 }
References q, and s.
| priority_queue<int, vector<int>, greater<int> > MinStack::q |
|
private |
| stack<int, deque<int> > MinStack::s |
|
private |
The documentation for this class was generated from the following file: