随笔分类 -  数据结构

摘要:#include #include #include #define MAXN 110 using namespace std; typedef char VertexType; typedef int EdgeType; int k; int s[MAXN]; int vis[MAXN]; typedef struct { char vexes[MAXN]; int map... 阅读全文
posted @ 2017-12-13 19:22 爱记录一切美好的微笑 阅读(2662) 评论(0) 推荐(0)
摘要:#include #include #include #include #include #include using namespace std; typedef struct node { node():data(' '), lchild(NULL), rchild(NULL) {} char data; struct node* lchild; stru... 阅读全文
posted @ 2017-04-14 20:53 爱记录一切美好的微笑 阅读(112) 评论(0) 推荐(0)
摘要:#include #include #include #include #include #include #include using namespace std; const int maxn=107; typedef struct node { node():height(0), lchild(NULL), rchild(NULL) {} int data; i... 阅读全文
posted @ 2017-04-14 20:49 爱记录一切美好的微笑 阅读(173) 评论(0) 推荐(0)
摘要:#include #include #include #include #include #include const int maxn=1007; const int INF=0x3f3f3f3f; using namespace std; typedef struct node { char ch; int weight; int parent, lchild, r... 阅读全文
posted @ 2017-04-14 20:49 爱记录一切美好的微笑 阅读(151) 评论(0) 推荐(0)
摘要:C++队列是一种容器适配器,它给予程序员一种先进先出(FIFO)的数据结构。1.back() 返回一个引用,指向最后一个元素2.empty() 如果队列空则返回真3.front() 返回第一个元素4.pop() 删除第一个元素5.push() 在末尾加入一个元素6.size() 返回队列中元素的个数 阅读全文
posted @ 2017-04-13 17:38 爱记录一切美好的微笑 阅读(235) 评论(0) 推荐(0)
摘要:大顶堆 小顶堆 阅读全文
posted @ 2017-04-09 16:44 爱记录一切美好的微笑 阅读(209) 评论(0) 推荐(0)
摘要:#include #include #include #include #include #define NOT_FOUND -1 using namespace std; const int maxn=10007; int n, k, a[maxn]; int Binary_Search() { int left=1; int right=n; while(left ... 阅读全文
posted @ 2017-03-31 19:56 爱记录一切美好的微笑 阅读(111) 评论(0) 推荐(0)
摘要:#include #include #include #include #include using namespace std; const int maxn=10007; int n, k, a[maxn]; int Order_Search() { int i; for(i=n; i>0&&a[i]!=k; i--); return i; } int main... 阅读全文
posted @ 2017-03-31 19:40 爱记录一切美好的微笑 阅读(97) 评论(0) 推荐(0)
摘要:http://acm.nyist.net/JudgeOnline/problem.php?pid=35 阅读全文
posted @ 2017-03-31 17:32 爱记录一切美好的微笑 阅读(123) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1237 阅读全文
posted @ 2017-03-31 17:31 爱记录一切美好的微笑 阅读(142) 评论(0) 推荐(0)
摘要:#include #include typedef int ElemType; enum Status { OK = 1, NOT_FOUND = 2, ERROR = 3 }; struct LinkListNode { LinkListNode():pre(NULL), next(NULL) {} ElemType data;... 阅读全文
posted @ 2017-03-31 17:30 爱记录一切美好的微笑 阅读(164) 评论(0) 推荐(0)
摘要:#include #include #define MAXSIZE 110 #define ok 1 #define error 0 typedef int SElemType; typedef int Status; ///顺序栈类型的定义 typedef struct { SElemType data[MAXSIZE]; int top; }SeqStack; ///顺... 阅读全文
posted @ 2016-10-23 17:30 爱记录一切美好的微笑 阅读(370) 评论(0) 推荐(0)
摘要:///用26个字母来实现简单的单链表的基本操作#include #include #define ok 1 #define error 0 #define MAXSIZE 100 typedef int ElemType; typedef int Status; typedef struct node { ElemType data; struct node *next; } ... 阅读全文
posted @ 2016-10-04 17:17 爱记录一切美好的微笑 阅读(299) 评论(0) 推荐(0)