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

Method sort

S-Stack/SortStack.cpp:53–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51
52
53void SortStack :: sort()
54{
55 priority_queue<int,vector<int>,greater<int>>pq; // declaring min heap
56
57 while(!st.empty()) // run the loop till the stack is not empty
58 {
59 pq.push(st.top());
60 st.pop();
61 }
62
63 while(!pq.empty()) // run the loop till the min heap is not empty
64 {
65 st.push(pq.top());
66 pq.pop();
67 }
68}

Callers

nothing calls this directly

Calls 4

emptyMethod · 0.80
pushMethod · 0.45
topMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected