亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? dlist.h

?? 一些簡單數(shù)據(jù)結(jié)構(gòu)的實(shí)現(xiàn)。 包括了鏈表、堆、棧等。
?? H
字號:
/*****************************
*         _DList_h_          *
*      Double Link List      *
*       class template       *
*       create by si.si      *
*          2007.9.19         *
******************************/

#ifndef _DList_h_
#define _DList_h_

//name space sisi's data structure
namespace SSDataS
{
/*
*List node class template 
*  of double link list
*/

	template<class T>
	class DListNode
	{
		
		//constructor and destructor
	public:
		~DListNode();
	private:
		/*
		*func constructor
		*the constructor of the node of this double link list
		*/
		DListNode( T newItem , DListNode<T>* prevpoint  = NULL, DListNode<T>* nextpoint = NULL);
		DListNode();


	public:
		/*
		*func getNewNode : DListNode<T>*  static
		*create a new node
		*@param newItem:T  the new data to store in this node
		*@param prevpoint:DListNode<T>* the pointer to prev node
		*@param nextpoint:DListNode<T>* the pointer to next node
		*@return a pointer to a new node
		*/
		static DListNode<T>* getNewNode(const T newItem , DListNode<T>* prevpoint  = NULL, DListNode<T>* nextpoint = NULL);

		//the data in node
		T item;
		//the pointer to next node
		DListNode<T>* next;
		//the pointer to prev node
		DListNode<T>* prev;
	};

/*
*Double link list class template
*/
	template<class T>
	class DList
	{
	public:
	//constructor and destructor
		DList();
		~DList();

	//fence pointer operate function
		/*
		*func getPresentData : T const
		*get the data of the node whitch fence pointer point to
		*@return : T item's data
		*/
		T getPresentData() const;
		
		/*
		*func getHeadData : T const
		*get the data in the head node
		*@return : T item's data
		*/
		T getHeadData() const;

		/*
		*func getTailData : T const
		*get the data in the tail node
		*@return : T item's data
		*/
		T getTailData() const;
		
		/*
		*func moveToHead : void 
		*move the fence pointer to the head of this list
		*/
		void moveToHead();

		/*
		*func moveToTail : void
		*move the fence pointer to the tail of this list
		*/
		void moveToTail();

		/*
		*func moveToNext : void
		*move the fence pointer to next node
		*/
		void moveToNext();

		/*
		*func moveToPrev : void
		*move the fence pointer to the prev node
		*/
		void moveToPrev();

	//insert and remove operate function
		/*
		*func insert : bool
		*insert new item to this list
		*@param newItem : T  the new item
		*@return : bool return true if success , else false
		*/
		bool insert(const T newItem);

		/*
		*func insertAtHead : bool
		*insert new item to the head of this list
		*@param newItem : T the new item
		*@return : bool return true if success , else false
		*/
		bool insertAtHead(const T newItem);

		/*
		*func insertAtTail : bool
		*insert new item to the tail of this list
		*@param newItem : T the new item
		*@return : bool return true if success , else false
		*/
		bool insertAtTail(const T newItem);

		/*
		*func removeFromHead : bool
		*remove the head node and set the next head
		*Return the item value in param reference
		*@param item : T reference to return the item value
		*@return : bool return true if success , else false
		*/
		bool removeFromHead(T& item);

		/*
		*func removeFromTail : bool
		*remove the tail node and set the prev tail.
		*Return the item value in param reference
		*@param item : T& reference to return the item value
		*@return : bool return true if success , else false
		*/
		bool removeFromTail(T& item);

		/*
		*func remove : bool
		*remove the node that the fence point to,and 
		*move the fence to next.
		*@return : bool return true if success , else false
		*/
		bool remove();

		/*
		*func remove : bool
		*remove the node that hold the data of aim item
		*@param aimItem : T the aim item
		*@return : bool return true if success , else false
		*/
		bool remove( const T aimItem );

		/*
		*func removeAll : bool
		*remove all node that in this list
		*@return : bool return true if success ,else false
		*/
		bool removeAll();

	//help function
		/*
		*func isEmpty : bool
		*get the EMPTY inf. of this list
		*@return : bool return true if empty
		*/
		bool isEmpty();

		/*
		*func find : bool
		*try to find the aim item in list, if find , set fence ptr to that node
		*@param aimItem : T the aim item
		*@return : bool return true if find ,else false
		*/
		bool find(const T aimItem);

	//inf get function
		/*
		*func getLength : int
		*get the length of this list
		*@return : int the length value
		*/
		int getLength() const;

		/*
		*func toItemArray : T[]
		*get a array that hold the all data in this list
		*@return : T[] 
		*/
		T* toItemArray(int& len);

	private:
		//the length of this list
		int length;
		//the head pointer;
		DListNode<T>* head;
		//the tail pointer;
		DListNode<T>* tail;
		//the fence pointer;
		DListNode<T>* fence;


	};
};



using namespace SSDataS;


template<class T>
DListNode<T>::DListNode(T newItem, SSDataS::DListNode<T> *prevpoint , SSDataS::DListNode<T> *nextpoint )
{
	item = newItem;
	next = nextpoint;
	prev = prevpoint;
}

template<class T>
DListNode<T>::DListNode()
{
	item = 0;
	next = NULL;
	prev = NULL;
}

template<class T>
DListNode<T>::~DListNode()
{
}

template<class T>
DListNode<T>* DListNode<T>::getNewNode(const T newItem, SSDataS::DListNode<T> *prevpoint , SSDataS::DListNode<T> *nextpoint )
{
	DListNode<T>* newNode = new DListNode<T>( newItem , prevpoint , nextpoint );
	return newNode;
}

template<class T>
DList<T>::DList()
{
	length = 0;
	head = NULL;
	tail = NULL;
	fence = NULL;
}

template<class T>
DList<T>::~DList()
{
}

template<class T>
T DList<T>::getPresentData() const
{
	if(NULL != fence)
		return fence->item;
	else
		return NULL;
}

template<class T>
T DList<T>::getHeadData() const
{
	if(NULL != head)
		return head->item;
	else 
		return NULL;
}

template<class T>
T DList<T>::getTailData() const
{
	if(NULL != tail)
		return tail->item;
	else
		return NULL;
}



template<class T>
void DList<T>::moveToHead()
{
	fence = head;
}

template<class T>
void DList<T>::moveToTail()
{
	fence = tail;
}

template<class T>
void DList<T>::moveToPrev()
{
	fence = fence->prev;
}

template<class T>
void DList<T>::moveToNext()
{
	fence = fence->next;
}

template<class T>
bool DList<T>::insert(const T newItem)
{
	if(isEmpty())
	{
		DListNode<T>* newNode = DListNode<T>::getNewNode(newItem , NULL , NULL);
		fence = head = tail = newNode;
		length++;
	}
	else if( fence == tail)
	{
		insertAtTail(newItem);
	}
	else
	{
		DListNode<T>* newNode = DListNode<T>::getNewNode(newItem , fence , fence->next);
		fence->next->prev = newNode;
		fence->next = newNode;
		length++;
	}
	return true;
}

template<class T>
bool DList<T>::insertAtHead( const T newItem )
{
	if(isEmpty())
	{
		DListNode<T>* newNode = DListNode<T>::getNewNode(newItem , NULL , NULL);
		fence = head = tail = newNode;
		length++;
	}
	else
	{
		DListNode<T>* newNode = DListNode<T>::getNewNode(newItem , NULL , head);
		head->prev = newNode;
		head = newNode;
		length++;
	}
	return true;
}

template<class T>
bool DList<T>::insertAtTail(const T newItem)
{
	if(isEmpty())
	{
		DListNode<T>* newNode = DListNode<T>::getNewNode(newItem , NULL , NULL);
		fence = head = tail = newNode;
		length++;
	}
	else
	{
		DListNode<T>* newNode = DListNode<T>::getNewNode(newItem , tail , NULL);
		tail->next = newNode;
		tail = newNode;
		length++;
	}
	return true;
}

template<class T>
bool DList<T>::remove()
{
	if(isEmpty())
		return false;
	DListNode<T>* temp = NULL;
	if(fence == head)
	{
		return removeFromHead(0);
	}
	else if(fence == tail)
	{
		return removeFromTail(0);
	}
	else
	{
		temp = fence;
		fence = fence->next;
		fence->prev = temp->prev;
		temp->prev->next = fence;
		delete temp;
		length--;
		return true;
	}	
}

template<class T>
bool DList<T>::remove(const T aimItem)
{
	if(fence->item == aimItem)
	{
		return remove();
	}
	if(!find(aimItem))
	{
		return false;
	}
	else
	{
		return remove();
	}
}

template<class T>
bool DList<T>::removeFromHead(T &item)
{
	DListNode<T>* temp = NULL;
	if(isEmpty())
		return false;
	if(head == tail)
	{
		temp = head;
		head = NULL;
		tail = NULL;
		fence = NULL;
		item = temp->item;
		delete temp;
		length--;
		return true;
	}
	else if( fence == head)
	{
		temp = head;
		head = head->next;
		fence = head;
		//fence->prev = NULL;
		item = temp->item;
		delete temp;
		length--;
		return true;
	}
	else
	{
		temp = head;
		head = head->next;
		head->prev = NULL;
		item = temp->item;
		delete temp;
		length--;
		return true;
	}

}

template<class T>
bool DList<T>::removeFromTail(T &item)
{
	DListNode<T>* temp = NULL;
	if(isEmpty())
		return false;
	if(head == tail)
	{
		temp = head;
		head = NULL;
		tail = NULL;
		fence = NULL;
		item = temp->item;
		delete temp;
		length--;
		return true;
	}
	else if( fence == tail)
	{
		temp = tail;
		tail = tail->prev;
		fence = tail;
		tail->next = NULL;
		item = temp->item;
		delete temp;
		length--;
		return true;
	}
	else
	{
		temp = tail;
		tail = tail->prev;
		tail->next = NULL;
		item = temp->item;
		delete temp;
		length--;
		return true;
	}
}

template<class T>
bool DList<T>::removeAll()
{
	if(isEmpty())
		return false;
	DListNode<T>* temp;
	fence = head;
	head = NULL;
	while( fence != tail )
	{
		temp = fence;
		fence = fence->next;
		delete temp;
	}
	fence = NULL;
	temp = tail;
	tail = NULL;
	delete temp;
	length =0;
	return true;
}

template<class T>
bool DList<T>::find(const T aimItem)
{
	if(isEmpty())
		return false;
	if(fence->item == aimItem)
		return true;
	fence = head;
	while(fence->item != aimItem)
	{
		if(fence == tail)
			return false;
		fence = fence->next;
	}
	return true;
}

template<class T>
bool DList<T>::isEmpty()
{
	if(length == 0)
		return true;
	else 
		return false;
}

template<class T>
int DList<T>::getLength() const
{
	return length;
}

template<class T>
T* DList<T>::toItemArray(int &len)
{
	if(isEmpty())
		return NULL;
	int i = 0;
	T* ItemArray = NULL;
	DListNode<T>* temp = fence;
	fence = head;
	ItemArray = new T[length];
	len = length;
	while(i < length)
	{
		ItemArray[i] = fence->item;
		fence = fence->next;
	}
	fence = temp;
	return ItemArray;
}

#endif

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产亚洲一区字幕| av亚洲精华国产精华| 欧美一级艳片视频免费观看| 亚洲韩国精品一区| 欧美日韩国产不卡| 麻豆精品在线观看| 欧美国产精品一区二区| 波多野结衣亚洲| 亚洲国产成人tv| 日韩欧美精品三级| 成人免费视频国产在线观看| 亚洲欧美乱综合| 欧美一个色资源| 成人性色生活片免费看爆迷你毛片| 亚洲欧洲国产日韩| 欧美久久久久免费| 高清不卡在线观看| 亚洲午夜羞羞片| 久久一日本道色综合| 成人午夜激情视频| 亚洲成精国产精品女| 欧美精品一区二区三区在线| 99国产精品久久久久久久久久| 亚洲成国产人片在线观看| 精品国产乱码久久久久久图片 | 日本中文字幕一区二区有限公司| www亚洲一区| 在线观看视频一区二区 | 亚洲成人免费av| 久久久久国产精品人| 欧美综合久久久| 国产在线乱码一区二区三区| 一区二区三区精密机械公司| 欧美不卡在线视频| 欧美午夜一区二区| 国产成人午夜99999| 午夜精品久久久久久久久| 久久九九影视网| 777奇米成人网| 91在线观看地址| 国产麻豆成人精品| 喷水一区二区三区| 亚洲狠狠爱一区二区三区| 欧美国产精品一区二区三区| 日韩精品一区国产麻豆| 欧美亚洲愉拍一区二区| 99综合影院在线| 国产精品一区二区视频| 免费观看在线综合| 亚洲国产精品久久一线不卡| 国产精品免费久久| 久久久精品黄色| 欧美成人三级在线| 欧美一区二区网站| 欧美日韩一区二区电影| 95精品视频在线| 国产宾馆实践打屁股91| 国产在线精品一区在线观看麻豆| 亚洲丶国产丶欧美一区二区三区| 综合久久综合久久| 国产区在线观看成人精品| 欧美videofree性高清杂交| 欧美精品久久一区二区三区| 欧美性高清videossexo| 一本色道久久综合亚洲aⅴ蜜桃| 国产精品资源在线看| 久久99久久99| 麻豆成人av在线| 蜜桃av噜噜一区| 免费在线观看不卡| 日本成人在线网站| 日韩高清一区二区| 丝袜美腿亚洲综合| 肉丝袜脚交视频一区二区| 亚洲国产视频直播| 亚洲国产精品一区二区久久 | 日韩精品中午字幕| 日韩女优制服丝袜电影| 欧美va在线播放| 欧美精品一区二区三| 精品国产污网站| 久久久久久久综合日本| 国产午夜精品美女毛片视频| 欧美极品xxx| 国产精品国产自产拍高清av王其| 国产精品美女久久久久aⅴ| 亚洲国产精品t66y| 亚洲精品视频自拍| 一区二区久久久久| 日韩av不卡一区二区| 久草在线在线精品观看| 国产一区二区三区四| av中文字幕不卡| 一本一道久久a久久精品综合蜜臀| 日本道色综合久久| 欧美疯狂做受xxxx富婆| 欧美成人一区二区| 国产精品成人一区二区艾草| 亚洲欧美国产三级| 日本va欧美va瓶| 国产精品一区二区三区网站| 91在线高清观看| 在线不卡a资源高清| 久久久综合网站| 亚洲日本护士毛茸茸| 日本人妖一区二区| 国产精品66部| 在线免费精品视频| 欧美变态tickling挠脚心| 国产精品国产成人国产三级| 午夜精品一区在线观看| 韩国女主播一区二区三区| 91啪亚洲精品| 欧美电视剧在线看免费| 国产精品免费视频一区| 日韩精品免费视频人成| 成人精品一区二区三区中文字幕 | 欧美一区二区三区免费大片| 中文字幕av一区二区三区高| 亚洲成人av中文| 成人高清免费在线播放| 777午夜精品视频在线播放| 国产精品久久久久一区二区三区共| 亚洲国产日韩一区二区| 国产一二精品视频| 精品视频一区二区不卡| 国产精品水嫩水嫩| 看片的网站亚洲| 91激情五月电影| 国产精品少妇自拍| 美女精品自拍一二三四| 在线视频你懂得一区二区三区| 久久亚洲精品小早川怜子| 亚洲gay无套男同| 91在线一区二区| 国产调教视频一区| 蜜乳av一区二区| 欧洲精品中文字幕| 国产精品久久久久aaaa樱花 | 久久精品国产亚洲a| 欧美亚洲国产怡红院影院| 国产精品伦理在线| 国产麻豆9l精品三级站| 欧美精品电影在线播放| 一区二区在线看| 不卡一卡二卡三乱码免费网站| 欧美岛国在线观看| 日韩主播视频在线| 欧美三级三级三级爽爽爽| 中文字幕在线视频一区| 国产精品99久久久久| 欧美本精品男人aⅴ天堂| 日本网站在线观看一区二区三区| 日本乱人伦aⅴ精品| 日韩理论片网站| 91在线视频在线| 中文字幕中文字幕在线一区| 从欧美一区二区三区| 国产日韩av一区| 成人精品在线视频观看| 国产日韩影视精品| 福利一区福利二区| 中文字幕av一区二区三区| 丰满岳乱妇一区二区三区| 亚洲国产精品精华液ab| 成人爽a毛片一区二区免费| 国产精品国产三级国产aⅴ无密码| 成人午夜在线播放| 一色桃子久久精品亚洲| 91网站最新网址| 中文字幕在线观看不卡视频| 99久久99久久精品免费看蜜桃 | 久久亚洲一区二区三区四区| 国产乱子伦一区二区三区国色天香| 精品88久久久久88久久久| 国产福利一区二区三区视频 | 欧美成人猛片aaaaaaa| 国模一区二区三区白浆| 26uuu亚洲| 国产成人亚洲综合a∨婷婷图片| 国产精品色婷婷久久58| 色综合咪咪久久| 午夜精品一区二区三区免费视频 | 成人午夜激情视频| 久久综合色8888| 国产成+人+日韩+欧美+亚洲| 中文字幕一区在线观看视频| 色94色欧美sute亚洲线路一久| 亚洲第一狼人社区| 欧美成人女星排行榜| 大美女一区二区三区| 一个色综合网站| 日韩写真欧美这视频| 国产成人精品免费视频网站| 亚洲欧美日韩电影| 日韩美女主播在线视频一区二区三区 | 欧美肥胖老妇做爰| 久久99最新地址| 一区二区三区欧美在线观看| 日韩欧美中文一区二区|