Exemplo n.º 1
0
            public int pop()
            {
                StackWithCapacity stack = getLastStack();
                int val = stack.pop();

                if (stack.isEmpty() && this.listOfStacks.Count > 1)
                {
                    listOfStacks.pop();
                }

                return(val);
            }
Exemplo n.º 2
0
            public void push(int item)
            {
                StackWithCapacity stack = getLastStack();

                if (!stack.isFull())
                {
                    stack.push(item);
                }
                else
                {
                    stack = new StackWithCapacity(this.capacityStacks);
                    stack.push(item);
                    listOfStacks.push(stack);
                }
            }