Ejemplo n.º 1
0
        public void Null_Stack_Using_LinkedList()
        {
            var head = new StackNodeSingly <int>(1);

            StackLinkedList <int> stack = new StackLinkedList <int>(head);

            Assert.Equal(1, stack.Pop());
            Assert.Equal(0, stack.Pop());
            stack.Push(new StackNodeSingly <int>(2));

            output.WriteLine(stack.Draw());
        }
Ejemplo n.º 2
0
        public void Implement_Stack_Using_LinkedList()
        {
            var head = new StackNodeSingly <int>(1);

            StackLinkedList <int> stack = new StackLinkedList <int>(head);

            stack.Push(new StackNodeSingly <int>(2));
            stack.Push(new StackNodeSingly <int>(3));
            Assert.Equal(3, stack.Pop());
            stack.Push(new StackNodeSingly <int>(4));
            Assert.Equal(4, stack.Pop());
            output.WriteLine(stack.Draw());
        }