62阅读
BFS

28阅读
#include <iostream> //poj 2243 Knight Moves 参照poj 1915#include <deque>using namespace std;int dir[2][8]={{-2,-1,1,2,2,1,-1,-2},{-1,-2,-2,-1,1,2,2,1}};int visited[10]

99阅读
2评论
public void bfs(boolean[]isVisited,int i){ int u;//表示队列的头结点对应的下标 int w;//表示邻接节点w //队列 LinkedList queue = new LinkedList(); //访问节点，输出节点信息 System.out.println(getValueByIndex(i)+"=>"); isVisited[i]=t.

38阅读
The ministers of the cabinet were quite upset by the message from the Chief of Security stating that they would all have to change the four-digit room numbers on their offices. — It is a matter of sec...

57阅读

91阅读
2评论
bfs的核心思想就是把一些问题抽象成图，从一个点开始，向四周开始扩散。一般使用队列这种数据结构，每次将一个节点周围所有节点加入队列。相较于dfs，bfs找到的路径一定是最短的，但代价就是空间复杂度比dfs大很多。从一个起点走到终点，问最短路径，这就是bfs的本质。下面为bfs大致模板int bfs(){ 初始化队列 初始化距离为-1 将起点距离设为0，并加入队列 while

89阅读
2评论
BFS & 双端BFS & A* & 双边BFS 1____广度优先搜索 1.1____什

119阅读

70阅读
2评论

341阅读

26阅读

4阅读
Fat brother and Maze are playing a kind of special (hentai) game on an N*M board (N rows, M columns). At the beginning, each grid of this board is consisting of grass or just empty and then they start...

39阅读
You are given two pots, having the volume of A and B liters respectively. The following operations can be performed: FILL(i) fill the pot i (1 ≤ i ≤ 2

56阅读

65阅读
2评论

101阅读
2评论
​​https://vjudge.net/problem/HDU-6223​​

79阅读
433.Minimum Genetic MutationMedium26836FavoriteShareA gene string can be represented by an 8-character long string, with choices from"A","C","G","T".Suppose we need to investigate about a...

48阅读

21阅读
• 1
• 2
• 3
• 4
• 5