Example #1
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);
        }
Example #2
0
 //Get the top element.
 public int Top()
 {
     return(top.GetData());
 }