www.pudn.com > Editor.rar > MyList.h


template 
struct Node{ 
/* 
链式队列的结点 
*/ 
	N data; 
	Node* next; 
	Node(); 
}; 
template 
Node::Node() 
{ 
	next=NULL; 
} 
template 
class MyList{ 
public: 
	//构造函数 
	MyList(); 
	//返回队头 
	L Front(); 
	//返回队尾 
	L Back(); 
	//返回position位置的结点值 
	L Position(int position); 
	//把x插入到队头 
	void Insert_front(L x); 
	//把x插入到队尾 
	void Insert_back(L x); 
	//把x插入到position位置 
	void Insert(int position,L x); 
	//移去队头 
	bool Remove_front(); 
	//移去队尾 
	bool Remove_back(); 
	//移去position位置的结点 
	bool Remove(int position); 
	//查看队列是否为空 
	bool empty(); 
	//查看队列的长度 
	int Size(); 
	//打印队列的元素 
	void Print(); 
public: 
	//队头 
	Node* front; 
	//队尾 
	Node* back; 
	//当前 
	Node* current; 
	//队列长度 
	int size; 
};