欢迎来到天天文库
浏览记录
ID:15505675
大小:1.45 MB
页数:321页
时间:2018-08-03
《数据结构各种算法实现(c++模板)》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、数据结构各种算法实现(C++模板)目录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、链式队列70QueueN
2、ode.h70LinkQueue.h71Test.cpp759、优先级队列77QueueNode.h77Compare.h78PriorityQueue.h80Test.cpp8510、串88MyString.h88MyString.cpp90test.cpp10111、二叉树104BinTreeNode.h104BinaryTree.h112Test.cpp12412、线索二叉树126ThreadNode.h126ThreadTree.h128ThreadInorderIterator.h128test.cpp13913、堆140MinHeap.h140test.cpp14
3、714、哈夫曼树149BinTreeNode.h149BinaryTree.h151MinHeap.h156Huffman.h161Test.cpp16315、树164QueueNode.h164LinkQueue.h165TreeNode.h169Tree.h170test.cpp18716、B+树189BTreeNode.h189BTree.h192test.cpp21517、图217MinHeap.h217Edge.h222Vertex.h223Graph.h224test.cpp24618、排序249Data.h249QueueNode.h255LinkQueue.h
4、259Sort.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~SeqList(){delete[]m_elements;}intLength()const{//
5、getthelengthreturnm_ncurrentsize+1;}intFind(Typex)const;//findthepositionofxintIsElement(Typex)const;//isitinthelistintInsert(Typex,inti);//insertdataintRemove(Typex);//deletedataintIsEmpty(){returnm_ncurrentsize==-1;}intIsFull(){returnm_ncurrentsize==m_nmaxsize-1;315数据结构算法实现2008-9-3}TypeGe
6、t(inti){//gettheithdatareturni<0
7、
8、i>m_ncurrentsize?(cout<<"can'tfindtheelement"<intSeqList::Find(Typex)const{for(inti=0;i9、数据结构算法实现2008-9-3returni;cout<<"can'tfindtheelementyouwanttofind"<intSeqList::IsElement(Typex)const{if(Find(x)==-1)return0;return1;}templateintSeqList::Insert(Typex,inti){if(i<010、11、i>m_ncurrent
9、数据结构算法实现2008-9-3returni;cout<<"can'tfindtheelementyouwanttofind"<intSeqList::IsElement(Typex)const{if(Find(x)==-1)return0;return1;}templateintSeqList::Insert(Typex,inti){if(i<0
10、
11、i>m_ncurrent
此文档下载收益归作者所有