using System;
namespace DataStructure
{
/// <summary>
/// Class 的摘要说明
/// </summary>
public class Stack//栈类
{
private int count=;
private Node first=null;//定义首结点
public bool Empty
{
get
{
return(first==null);
}
}
public int Count
{
get
{
return count;
}
}
public object Pop()//入栈
{
if(first==null)
{
throw new InvalidOperationException(Can not pop from an empty stack;);
}
else
{
object temp=firstValue;
first=firstNext;
count;
return temp;
}
}
public void push(object o)//出栈
{
first=new Node(ofirst);
count++;
}
public Stack()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
}
class Node //结点类
{
public Node Next;
public object Value;
public Node(object value):this(valuenull){}
public Node(object valueNode next)
{
Next=next;
Value=value;
}
}
}