public int Pop() { SNode runner = Top; while (runner.Next.Next != null) { runner = runner.Next; } SNode retVal = runner.Next; runner.Next = runner.Next.Next; return(retVal.Value); }
public void Add(int val) { if (Top == null) { Top = new SNode(val); } else { SNode runner = Top; while (runner.Next != null) { runner = runner.Next; } runner.Next = new SNode(val); } }
public Stacks() { Top = null; }
public SNode(int val) { Value = val; Next = null; }