摘要: 本人刚学数据结构,对树的基本功能网上找不到C++代码便自己写了一份,贴出方便大家进行测试和学习。大部分功能未测试,如有错误或者BUG,请高手们指教一下,谢谢。结点声明:BinTreeNode.h 1 template 2 struct BinTreeNode 3 { 4 ElemType d... 阅读全文
posted @ 2015-02-10 20:03 Tiey 阅读(4190) 评论(0) 推荐(1)
摘要: 并不是很精简,随便改改A过了就没有再简化了。1020.Problem DescriptionGiven a string containing only 'A' - 'Z', we could encode it using the following method:1. Each sub-stri... 阅读全文
posted @ 2015-02-04 23:11 Tiey 阅读(549) 评论(0) 推荐(0)
摘要: 本文直接转载,非原创!仅记录供自己学习之用。出处:http://blog.csdn.net/y990041769/article/details/8763366在学习c++STL中的string,在这里做个笔记,以供自己以后翻阅和初学者参考。1:string对象的定义和初始化以及读写string s... 阅读全文
posted @ 2015-02-03 21:09 Tiey 阅读(1219) 评论(0) 推荐(0)
摘要: 文字介绍KMP我就不讲了,相信大家看了不少别的文章也没看懂,我肯定也不能用文字表达清楚。最好的办法就是看严老师的视频,讲的很清晰。请百度 KMP 严蔚敏;在这里我用C++实现一下; 1 #include 2 #include 3 #include 4 using namespace ... 阅读全文
posted @ 2015-02-03 19:46 Tiey 阅读(420) 评论(0) 推荐(0)
摘要: 刚学完set,准备做个简单题目实践一下。结果半天都WA。下面指出WA原因。方法是这样的,把所有输的赢的都插入a1,输的插入a2;那么如果最后name1-name2=1,则说明只有他没输过,能判断出冠军就是剩下的那个人。 1 #include 2 #include 3 #include 4 using... 阅读全文
posted @ 2015-02-02 20:05 Tiey 阅读(200) 评论(0) 推荐(0)
摘要: #include"LinkQueue.h"void yhTriangle(int n){ LinkQueue A; int s,t; A.Inqueue(1);A.Inqueue(1); cout<<1<<endl; cout<<1<<"\t"<<1<<endl; for(int i=3;i<=n;... 阅读全文
posted @ 2015-02-02 16:46 Tiey 阅读(362) 评论(0) 推荐(0)
摘要: 1 template 2 class SqQueue 3 { 4 protected: 5 int count; 6 int front,rear; 7 int maxSize; 8 ElemType *elem; 9 public: 10 ... 阅读全文
posted @ 2015-02-02 16:45 Tiey 阅读(804) 评论(0) 推荐(0)
摘要: 关于Node.h,请参考LinkStack 1 #include"Node.h" 2 template 3 class LinkQueue 4 { 5 protected: 6 Node *front,*rear; 7 int count; 8 public: 9 ... 阅读全文
posted @ 2015-02-02 16:44 Tiey 阅读(1352) 评论(0) 推荐(0)
摘要: 用自己定义的链栈实现括号匹配 1 #include"LinkStack.h" 2 bool Match(char *s) 3 { 4 LinkStack tmpS; 5 char tmpCh; 6 for(int i=0;i<strlen(s);i++) 7 { 8 ... 阅读全文
posted @ 2015-02-02 16:42 Tiey 阅读(384) 评论(0) 推荐(0)
摘要: 1 //Node.h 2 template 3 struct Node 4 { 5 ElemType data; 6 Node *next; 7 Node(); 8 Node(ElemType item,Node * link=NULL); 9 }... 阅读全文
posted @ 2015-02-02 16:41 Tiey 阅读(498) 评论(0) 推荐(0)