随笔分类 - 算法
摘要:选择排序 #include <bits/stdc++.h> using namespace std; #define ll int const int INF = INT_MAX;/// int的极限值 const int maxn = 1e5+7; int mine = -INF; /// int
阅读全文
摘要:#include <bits/stdc++.h> using namespace std; const int maxn=1e5+7; const int INF=0x3f3f3f3f; struct Huffman_Node{ int ans; int father; int left; int
阅读全文
摘要:广度(宽度)优先搜索的话就是按照层次来寻找 队列实现(普通队列) 宽度,顾名思义就是按照同一个层次进行宽度扩展 层次1:节点1 层次2:节点2 层次3:节点3 节点4 层次4:节点5 节点6 节点7 节点8 实现思路: 首先把相同层次的节点(在迷宫里面,一个点能走到其他八个方向的点是同一个层次)如下
阅读全文
摘要:迷宫图可能比较抽象,把迷宫图按照45度倾斜就是一棵树一样的。现在来看这棵树 首先肯定是从起点1开始的 深度优先是按照一条链跑到底 所以就是按照 1 -> 2 -> 3 ->6 1 -> 2 -> 3 ->5 1 -> 2 -> 4 ->8 1 -> 2 -> 4 ->7 每次都从开始跑到最后不能跑的
阅读全文

浙公网安备 33010602011771号