数据结构各种算法实现(c++模板)

数据结构各种算法实现(c++模板)

ID:15505675

大小:1.45 MB

页数:321页

时间:2018-08-03

数据结构各种算法实现(c++模板)_第1页
数据结构各种算法实现(c++模板)_第2页
数据结构各种算法实现(c++模板)_第3页
数据结构各种算法实现(c++模板)_第4页
数据结构各种算法实现(c++模板)_第5页
资源描述:

《数据结构各种算法实现(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;i

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

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。