Exemple #1
0
        //Removes the element on top of the stack.
        public void Pop()
        {
            Stack_Node temp = this.top;

            this.top = top.GetNext();
            temp.Dispose();
        }
Exemple #2
0
        //Retrieve the minimum element in the stack.
        public int GetMin()
        {
            int        output = this.top.GetData();
            Stack_Node temp   = this.top;

            while (temp != null)
            {
                if (temp.GetData() < output)
                {
                    output = temp.GetData();
                }
                temp = temp.GetNext();
            }
            return(output);
        }