public Type Pop()//出栈 { Type dt = top.Data; top = top.Next; return(dt); }
public string GetStackALLDate(string sname) { string str = " 】"; if (IsEmpty()) { str = sname + " stack is null"; } CStacknode <Type> p = top; while (p != null) { str = p.Data + " " + str; p = p.Next; } str = "【 " + str + "\r\n"; str = str + "---------------------------------------" + "\r\n"; return(str); }
public bool Push(Type item)//入栈 { top = new CStacknode <Type>(item, top); return(true); }
} //判栈满 public CLinkStack() { top = null; }
//-------------------------------------------------------------------------------- public void MakeEmpty() { top = null; } //清空
public CStacknode(Type data, CStacknode <Type> next) { this.data = data; this.next = next; }
public CStacknode(Type data) { this.data = data; next = null; }
//-------------------------------------------------------------------------------- public CStacknode() { next = null; }