随笔分类 - 数据结构
摘要:#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...
阅读全文
摘要:#include #include #include #include #include #include using namespace std; typedef struct node { node():data(' '), lchild(NULL), rchild(NULL) {} char data; struct node* lchild; stru...
阅读全文
摘要:#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...
阅读全文
摘要:#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...
阅读全文
摘要:C++队列是一种容器适配器,它给予程序员一种先进先出(FIFO)的数据结构。1.back() 返回一个引用,指向最后一个元素2.empty() 如果队列空则返回真3.front() 返回第一个元素4.pop() 删除第一个元素5.push() 在末尾加入一个元素6.size() 返回队列中元素的个数
阅读全文
摘要:#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 ...
阅读全文
摘要:#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...
阅读全文
摘要:http://acm.nyist.net/JudgeOnline/problem.php?pid=35
阅读全文
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1237
阅读全文
摘要:#include #include typedef int ElemType; enum Status { OK = 1, NOT_FOUND = 2, ERROR = 3 }; struct LinkListNode { LinkListNode():pre(NULL), next(NULL) {} ElemType data;...
阅读全文
摘要:#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; ///顺...
阅读全文
摘要:///用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; } ...
阅读全文

浙公网安备 33010602011771号