欢迎来到天天文库
浏览记录
ID:26072500
大小:707.00 KB
页数:321页
时间:2018-11-24
《数据结构各种算法实现(c 模板)》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、目录1、顺序表1Seqlist.h1Test.cpp62、单链表8ListNode.h8SingleList.h10test.cpp203、双向链表22NodeList.h22DoubleList.h24Test.cpp344、循环链表36ListNode.h36CircularList.h37Test.cpp475、顺序栈49SeqStack.h49Test.cpp546、链式栈55StackNode.h55LinkStack.h56Test.cpp607、顺序队列62SeqQueue.h63Test.cpp688、链
2、式队列70QueueNode.h70LinkQueue.h71Test.cpp759、优先级队列77QueueNode.h77Compare.h78PriorityQueue.h80Test.cpp8510、串88MyString.h88MyString.cpp90test.cpp10111、二叉树104BinTreeNode.h104BinaryTree.h112Test.cpp12412、线索二叉树126ThreadNode.h126ThreadTree.h128ThreadInorderIterator.h128t
3、est.cpp13913、堆140MinHeap.h140test.cpp14714、哈夫曼树149BinTreeNode.h149BinaryTree.h151MinHeap.h156Huffman.h161Test.cpp16315、树164QueueNode.h164LinkQueue.h165TreeNode.h169Tree.h170test.cpp18716、B+树189BTreeNode.h189BTree.h192test.cpp21517、图217MinHeap.h217Edge.h222Vertex.
4、h223Graph.h224test.cpp24618、排序249Data.h249QueueNode.h255LinkQueue.h259Sort.h263test.cpp278数据结构算法实现2008-9-31、顺序表Seqlist.hconstintDefaultSize=100;templateclassSeqList{public:SeqList(intsz=DefaultSize):m_nmaxsize(sz),m_ncurrentsize(-1){if(sz>0){m_eleme
5、nts=newType[m_nmaxsize];}}316数据结构算法实现2008-9-3~SeqList(){delete[]m_elements;}intLength()const{//getthelengthreturnm_ncurrentsize+1;}intFind(Typex)const;//findthepositionofxintIsElement(Typex)const;//isitinthelistintInsert(Typex,inti);//insertdataintRemove(Typex);/
6、/deletedataintIsEmpty(){returnm_ncurrentsize==-1;}intIsFull(){returnm_ncurrentsize==m_nmaxsize-1;316数据结构算法实现2008-9-3}TypeGet(inti){//gettheithdatareturni<0
7、
8、i>m_ncurrentsize?(cout<<"can'tfindtheelement"<9、constintm_nmaxsize;intm_ncurrentsize;};templateintSeqList::Find(Typex)const{for(inti=0;iintSeqLis10、t::IsElement(Typex)const{if(Find(x)==-1)return0;return1;}templateintSeqList::Insert(Typex,inti){if(i<011、12、i>m_ncurrentsize+113、14、m_ncurren
9、constintm_nmaxsize;intm_ncurrentsize;};templateintSeqList::Find(Typex)const{for(inti=0;iintSeqLis
10、t::IsElement(Typex)const{if(Find(x)==-1)return0;return1;}templateintSeqList::Insert(Typex,inti){if(i<0
11、
12、i>m_ncurrentsize+1
13、
14、m_ncurren
此文档下载收益归作者所有