public void Run() { StackWithMin stack = new StackWithMin(); StackWithMin2 stack2 = new StackWithMin2(); for (int i = 1; i <= 10; i++) { int value = AssortedMethods.RandomIntInRange(0, 100); stack.Push2(value); stack2.Push2(value); Console.Write(value + ", "); } Console.WriteLine('\n'); for (int i = 1; i <= 10; i++) { Console.WriteLine("Popped " + stack.Pop().Value + ", " + stack2.Pop2()); Console.WriteLine("New min is " + stack.Min() + ", " + stack2.Min()); } }
static void Main(string[] args) { StackWithMin stack = new StackWithMin(); stack.push(5); stack.push(6); stack.push(3); stack.push(7); Console.WriteLine(stack.Min()); stack.pop(); stack.pop(); Console.WriteLine(stack.Min()); StackWithMin2 stack2 = new StackWithMin2(); stack2.push(5); stack2.push(6); stack2.push(3); stack2.push(7); Console.WriteLine(stack2.Min()); stack2.pop(); stack2.pop(); Console.WriteLine(stack2.Min()); }