MCPcopy Create free account
hub / github.com/Lakhankumawat/LearnCPP / pop

Method pop

S-Stack/StacksUsingQueue.cpp:83–100  ·  view source on GitHub ↗

pop expensive

Source from the content-addressed store, hash-verified

81
82 //pop expensive
83 void pop(){
84 if(q1.empty()){
85 cout << "Stack is empty!" << endl;
86 return ;
87 }
88
89 while(q1.size() != 1){
90 q2.push(q1.front());
91 q1.pop();
92 }
93
94 q1.pop();
95 N--;
96
97 queue<int> temp = q1;
98 q1 = q2;
99 q2 = temp;
100 }
101
102 int top(){
103 if(q1.empty()){

Callers

nothing calls this directly

Calls 4

emptyMethod · 0.80
sizeMethod · 0.45
pushMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected