コード例 #1
0
ファイル: LLStack.cs プロジェクト: moosearch/Sample-ADTs
	/** Pops off the top item from stack */
	public override object Pop()
	{
		if (IsEmpty()) throw new EmptyStackException("Nothing in LLStack. ");
		Node temp = top;
		if (top.next != null)
			{top = top.next;}
		else 
			top = bot = null;
		temp.next = null;
		return temp;
	}
コード例 #2
0
ファイル: LLStack.cs プロジェクト: moosearch/Sample-ADTs
	/** Stores an item on the top of the stack. */
	public override void Push(object item)
	{
		Node newItem = WrapObject(item);
		Node temp = null;
		if (IsEmpty()) {top = bot = newItem; }
		else 
		{ 
			temp = top;
			top = newItem;
			top.next = temp;
		}
	}
コード例 #3
0
ファイル: LLStack.cs プロジェクト: moosearch/Sample-ADTs
	public Node(){
		this.data = null;
		this.next = null;
	}
コード例 #4
0
ファイル: LLStack.cs プロジェクト: moosearch/Sample-ADTs
	public LLStack(){
		top = null;
		bot = null;
	}
コード例 #5
0
ファイル: LLStack.cs プロジェクト: moosearch/Sample-ADTs
	public void ClearLink(){
		this.next = null;
	}