(Stack<Integer> s, int data)
| 3 | |
| 4 | public class Question3 { |
| 5 | public static void pushAtBottom(Stack<Integer> s, int data) { |
| 6 | if(s.isEmpty()) { |
| 7 | s.push(data); |
| 8 | return; |
| 9 | } |
| 10 | |
| 11 | int temp = s.pop(); |
| 12 | pushAtBottom(s, data); |
| 13 | s.push(temp); |
| 14 | } |
| 15 | |
| 16 | public static void reverse(Stack<Integer> s) { |
| 17 | if(s.isEmpty()) { |