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

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

?? dlist.h

?? 一個基于A*算法的尋路類。完全C++實現(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
*/
#define NULL  0
	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一区二区三区免费野_久草精品视频
欧美一区二区三区日韩| 亚洲少妇30p| 日韩欧美国产一区二区在线播放| 欧美日韩亚洲综合| 欧美人xxxx| 一区二区三区在线免费观看| 中文字幕日韩一区| 中文字幕一区二区三区四区不卡 | 亚洲人妖av一区二区| 国产欧美一区二区三区沐欲| 国产日韩一级二级三级| 欧美经典三级视频一区二区三区| 国产欧美一区二区精品婷婷| 久久精品视频在线看| 欧美国产国产综合| 亚洲欧洲精品天堂一级| 亚洲欧洲三级电影| 亚洲免费毛片网站| 天天av天天翘天天综合网| 日韩精品电影在线| 久久99热狠狠色一区二区| 九九九精品视频| 国产99久久久国产精品潘金| av中文字幕亚洲| 欧美日韩一区视频| 精品少妇一区二区三区| 国产喷白浆一区二区三区| 国产精品国产三级国产普通话99 | 99这里都是精品| 色欧美乱欧美15图片| 欧美肥胖老妇做爰| 久久亚洲精品小早川怜子| 中文字幕一区二区三区av| 一区二区三区精品在线观看| 日韩高清不卡在线| 国产精品一区二区在线看| 一本色道久久综合亚洲91 | 亚洲精品国产一区二区三区四区在线| 亚洲精品成a人| 污片在线观看一区二区| 国产高清精品久久久久| 色综合久久久久综合体| 日韩欧美aaaaaa| **欧美大码日韩| 日本va欧美va精品| av色综合久久天堂av综合| 欧美日韩国产首页| 日本一区二区电影| 亚洲不卡在线观看| 国产成人av一区二区| 欧美性色欧美a在线播放| 久久影音资源网| 亚洲最大成人综合| 国产激情一区二区三区桃花岛亚洲| 91麻豆免费观看| 精品国产伦一区二区三区免费| 中文字幕综合网| 韩国三级在线一区| 欧美高清视频一二三区 | 欧美一区二区在线观看| 国产精品久久久久久亚洲毛片| 欧美视频一区在线观看| 精品国偷自产国产一区| 亚洲一卡二卡三卡四卡无卡久久 | 韩国一区二区视频| 欧美日韩美少妇| 中文字幕永久在线不卡| 麻豆91在线播放| 在线观看日韩一区| 国产精品免费网站在线观看| 麻豆成人久久精品二区三区小说| 在线观看亚洲a| 国产精品剧情在线亚洲| 韩国三级电影一区二区| 欧美二区三区的天堂| 亚洲免费电影在线| 成人激情校园春色| 久久美女艺术照精彩视频福利播放| 亚洲国产成人91porn| 99re这里只有精品视频首页| 国产视频不卡一区| 极品美女销魂一区二区三区免费| 欧美日韩美少妇| 亚洲午夜日本在线观看| 一本大道久久a久久综合婷婷 | 久久精品国产久精国产| 欧美视频中文字幕| 亚洲美女在线国产| av在线不卡电影| 国产精品美女久久久久久| 国产在线视频精品一区| 欧美一区在线视频| 日韩精品乱码免费| 欧美一区午夜精品| 日韩高清在线一区| 欧美一区二区免费| 免费视频最近日韩| 日韩欧美一级二级| 久久精品国产亚洲a| 日韩精品综合一本久道在线视频| 日本欧美肥老太交大片| 91精品欧美福利在线观看| 亚洲第一精品在线| 欧美人妖巨大在线| 日韩制服丝袜先锋影音| 欧美一级国产精品| 免费观看成人鲁鲁鲁鲁鲁视频| 9191成人精品久久| 男女男精品视频| 久久综合色天天久久综合图片| 久久国产尿小便嘘嘘| 久久午夜色播影院免费高清| 国产真实乱偷精品视频免| 久久女同精品一区二区| 成人小视频免费在线观看| 国产精品久久久久一区二区三区| 99久久99久久免费精品蜜臀| 自拍偷拍欧美精品| 欧美三级乱人伦电影| 日韩高清在线观看| 精品久久久久99| 国产+成+人+亚洲欧洲自线| 中文字幕一区二区三区不卡| 日本道免费精品一区二区三区| 亚洲激情欧美激情| 7777精品伊人久久久大香线蕉经典版下载| 日韩精品国产精品| 久久老女人爱爱| 99久久综合精品| 亚洲成av人片一区二区| 精品精品国产高清一毛片一天堂| 成人午夜视频在线观看| 一区二区三区欧美日| 日韩精品三区四区| 国产日韩欧美精品电影三级在线| 成人亚洲精品久久久久软件| 一区二区日韩av| 日韩精品一区二区三区视频| 岛国av在线一区| 亚洲国产精品久久久久秋霞影院| 日韩欧美资源站| 成人一区二区在线观看| 亚洲一区二区三区四区五区黄 | 丰满少妇在线播放bd日韩电影| 最新日韩在线视频| 在线播放亚洲一区| 高清不卡一二三区| 亚洲成人综合视频| 国产人妖乱国产精品人妖| 欧美三区在线观看| 国产成a人亚洲精品| 亚洲午夜私人影院| 国产色一区二区| 欧美久久一二区| 国产99久久久久久免费看农村| 一区二区三区欧美| 国产人成亚洲第一网站在线播放| 欧美三级蜜桃2在线观看| 国产成人自拍高清视频在线免费播放| 亚洲激情图片一区| 久久久精品中文字幕麻豆发布| 在线观看亚洲a| 福利视频网站一区二区三区| 三级亚洲高清视频| 中文字幕人成不卡一区| 日韩欧美国产1| 欧美午夜电影在线播放| 粉嫩av亚洲一区二区图片| 日韩av网站在线观看| 一区二区三区欧美视频| 国产农村妇女精品| 日韩欧美国产电影| 欧美日韩精品一区二区三区蜜桃| 成人黄色在线看| 国内精品免费**视频| 五月天亚洲精品| 亚洲免费看黄网站| 国产精品毛片久久久久久 | 日韩va亚洲va欧美va久久| 国产精品国产a级| 日韩精品中文字幕一区| 欧美日韩激情一区二区三区| 成人精品免费视频| 国内久久精品视频| 日本不卡不码高清免费观看| 亚洲一区日韩精品中文字幕| 国产精品高潮呻吟久久| 国产日本欧美一区二区| 精品国产第一区二区三区观看体验 | 亚洲激情图片qvod| 国产精品高潮呻吟| 国产精品―色哟哟| 国产三级三级三级精品8ⅰ区| 日韩欧美一级片| 91精品国产色综合久久| 91精选在线观看| 在线播放91灌醉迷j高跟美女| 欧美日韩在线播放| 欧美色偷偷大香| 欧美日韩激情在线|