pushin function to insert elements at correct position
| 4 | stack<int> st; |
| 5 | //pushin function to insert elements at correct position |
| 6 | void 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 |
| 20 | void reverse(){ |
| 21 | if(st.size()==1)return; |