| 4 | |
| 5 | public class Question { |
| 6 | public static void main(String[] args) { |
| 7 | StackWithMin stack = new StackWithMin(); |
| 8 | StackWithMin2 stack2 = new StackWithMin2(); |
| 9 | for (int i = 0; i < 15; i++) { |
| 10 | int value = AssortedMethods.randomIntInRange(0, 100); |
| 11 | stack.push(value); |
| 12 | stack2.push(value); |
| 13 | System.out.print(value + ", "); |
| 14 | } |
| 15 | System.out.println('\n'); |
| 16 | for (int i = 0; i < 15; i++) { |
| 17 | System.out.println("Popped " + stack.pop().value + ", " + stack2.pop()); |
| 18 | System.out.println("New min is " + stack.min() + ", " + stack2.min()); |
| 19 | } |
| 20 | } |
| 21 | |
| 22 | } |