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