public int Min() { if (s2.IsEmpty()) { return(int.MaxValue); } else { return(s2.Peek()); } }
public bool Sort() { if (stack.IsEmpty()) { return(false); } while (!stack.IsEmpty()) { int top = stack.Pop(); while (!tempStack.IsEmpty() && tempStack.Peek() > top) { stack.Push(tempStack.Pop()); } tempStack.Push(top); } while (!tempStack.IsEmpty()) { stack.Push(tempStack.Pop()); } return(true); }