MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / pushin

Function pushin

Java/Stack/reverseasttring.cpp:6–18  ·  view source on GitHub ↗

pushin function to insert elements at correct position

Source from the content-addressed store, hash-verified

4stack<int> st;
5//pushin function to insert elements at correct position
6void pushin(int t){
7 if(st.size()==0){
8 st.push(t);
9 return;
10 }
11 else{
12 int val=st.top();
13 st.pop();
14 pushin(t);
15 st.push(val);
16 return;
17 }
18}
19//reverse function
20void reverse(){
21 if(st.size()==1)return;

Callers 1

reverseFunction · 0.85

Calls 4

topMethod · 0.80
sizeMethod · 0.45
pushMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected