![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
algorithm
樱落为萤火
立个小目标,两年啃完西瓜书,两年做个游戏上架steam!!!!
展开
-
深度搜索解决迷宫问题
深度搜索解决迷宫问题 最近在学算法和数据结构,解决了利用深度搜索解决50*50的迷宫问题。做个笔记来方便以后复习。 代码如下: #include<stdio.h> int row,list,destination_x,destination_y,min=99999999; int a[51][51],book[51][51]; void dfs(int x,int y,int step) { int next[4][2]= {{1,0},//向右走 {-1,0},//向左走 {0,1},原创 2020-12-25 20:02:48 · 174 阅读 · 0 评论 -
深度优先搜索解决全排列问题
深度优先搜索解决全排列问题 最近在看算法和数据结构,做个笔记来方便自己日后看复习。 代码如下:要说的都在注释里面了 #include<stdio.h> int a[10],book[10],n;//定义全局变量 void dfs(int step) { int i; //判断是否到达最后 if(step==n+1) { for(i=1;i<=n;i++) { printf("%d",a[i]); } printf("\n"); return; } fo原创 2020-12-25 19:58:39 · 247 阅读 · 0 评论