欢迎来到天天文库
浏览记录
ID:36479407
大小:1.29 MB
页数:321页
时间:2019-05-11
《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、链式队列70QueueNod
2、e.h70LinkQueue.h71Test.cpp759、优先级队列77QueueNode.h77Compare.h78PriorityQueue.h80Test.cpp8510、串88MyString.h88MyString.cpp90test.cpp10111、二叉树104BinTreeNode.h104BinaryTree.h112Test.cpp12412、线索二叉树126ThreadNode.h126ThreadTree.h128ThreadInorderIterator.h128test.cpp13913、堆140MinHeap.h
3、140test.cpp14714、哈夫曼树149BinTreeNode.h149BinaryTree.h151MinHeap.h156Huffman.h161Test.cpp16315、树164QueueNode.h164LinkQueue.h165TreeNode.h169Tree.h170test.cpp18716、B+树189BTreeNode.h189BTree.h192test.cpp21517、图217MinHeap.h217Edge.h222Vertex.h223Graph.h224test.cpp24618、排序249Data.h
4、249QueueNode.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_elements=newType[m_nmaxsize];}}315数据结构算法实现2008-9-3~SeqLis
5、t(){delete[]m_elements;}intLength()const{//getthelengthreturnm_ncurrentsize+1;}intFind(Typex)const;//findthepositionofxintIsElement(Typex)const;//isitinthelistintInsert(Typex,inti);//insertdataintRemove(Typex);//deletedataintIsEmpty(){returnm_ncurrentsize==-1;}intIsFull(){ret
6、urnm_ncurrentsize==m_nmaxsize-1;315数据结构算法实现2008-9-3}TypeGet(inti){//gettheithdatareturni<0
7、
8、i>m_ncurrentsize?(cout<<"can'tfindtheelement"<intSeqList:
9、:Find(Typex)const{for(inti=0;iintSeqList::IsElement(Typex)const{if(Find(x)==-1)return0;return1;}templateintSeq
10、List::Insert(Typex,inti){if(i<0
11、
12、i>m_ncurrentsize+1
13、
14、m_ncurren
此文档下载收益归作者所有