查找(数据结构)
INGNIGHT
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
哈理工oj1181
#include #include using namespace std; struct node { int x;//点的坐标 int y; int s;//记录步数 }; int main() { int startx,starty; int endx,endy; int tx,ty; int n,m; int k;原创 2015-08-13 22:10:58 · 1567 阅读 · 0 评论 -
宝岛探险2
#include using namespace std; int book[51][51]={0}; int a[51][51]; int sum; int n,m; void dfs(int x,int y,int color) { int tx,ty; int k; //定义一个方向的数组 int next[4][2]={{0,1},{1,0},{0,-1},原创 2015-08-13 20:44:18 · 943 阅读 · 0 评论 -
宝岛探险1(DFS)
#include using namespace std; int book[51][51]={0}; int a[51][51]; int sum; int n,m; void dfs(int x,int y) { int tx,ty; int k; //定义一个方向的数组 int next[4][2]={{0,1},{1,0},{0,-1},{-1,0}};原创 2015-08-13 20:26:59 · 759 阅读 · 0 评论 -
宝岛探险1(BFS)
/* 0表示海洋 1~9都表示陆地 startx,starty为着陆地点 算出降落小岛的面积 */#include using namespace std; struct node { int x; int y; }; int main() { int a[50][50]; node que[2051]; int n,m; int startx,st原创 2015-08-12 22:34:12 · 888 阅读 · 0 评论 -
炸弹人
#include using namespace std; struct note { int x; int y; }; char a[20][21]; int getsum(int i,int j) { int sum,x,y; sum=0; x=i; y=j; while(a[x][y]!='#') { if(原创 2015-08-12 21:26:50 · 1277 阅读 · 0 评论 -
迷宫探索
/* 5 4 0 0 1 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1 1 1 4 3 */ #include using namespace std; struct node { int x;//横坐标 int y;//纵坐标 int f;//父亲在队列中的编号 int s;//步数 }; int main() { nod原创 2015-08-11 13:34:23 · 1073 阅读 · 0 评论 -
KMP
#include #include using namespace std; int *GetNext(char *str) { if(str == NULL) { return NULL; } int *next = new int[strlen(str)]; int i = 1; int ID = i-1; next原创 2016-01-25 20:23:01 · 443 阅读 · 0 评论 -
字典树Trie_Tree
#include #include using namespace std; struct Trie_Tree { char *str; int nFlag; Trie_Tree *arr[26]; }; Trie_Tree *CreateNode() { Trie_Tree *temp = new Trie_Tree; memset(temp,0,4*原创 2016-01-25 20:29:07 · 525 阅读 · 0 评论 -
红黑树
红黑树与2-3树具有等价性,我们在了解红黑树前先了解2-3树对我们理解红黑树是有帮助的,同时,对于理解B树也是有帮助的(用于磁盘存储,文件系统或数据库存储) 1. 2-3树 下面的图片就是一颗2-3树 可以看出,2-3树是一棵绝对平衡的树——根节点到任意一个叶子节点所经过的节点数量是相同的 那么2-3树是怎样来维护它的绝对平衡的呢?我们来看看下面例子 ...原创 2019-08-05 10:54:55 · 291 阅读 · 0 评论
分享