-
c编程技巧100之4
c编程技巧100之4-the four hundred
- 2022-01-31 02:57:29下载
- 积分:1
-
[输入]
图的顶点个数N,图中顶点之间的关系及起点A和终点B
[输出]
若A到B无路径,则输出“There is no path” 否则输出A到B路...
[输入]
图的顶点个数N,图中顶点之间的关系及起点A和终点B
[输出]
若A到B无路径,则输出“There is no path” 否则输出A到B路径上个顶点
[存储结构]
图采用邻接矩阵的方式存储。
[算法的基本思想]
采用广度优先搜索的方法,从顶点A开始,依次访问与A邻接的顶点VA1,VA2,...,VAK, 访问遍之后,若没有访问B,则继续访问与VA1邻接的顶点VA11,VA12,...,VA1M,再访问与VA2邻接顶点...,如此下去,直至找到B,最先到达B点的路径,一定是边数最少的路径。实现时采用队列记录被访问过的顶点。每次访问与队头顶点相邻接的顶点,然后将队头顶点从队列中删去。若队空,则说明到不存在通路。在访问顶点过程中,每次把当前顶点的序号作为与其邻接的未访问的顶点的前驱顶点记录下来,以便输出时回溯。
#include
int number //队列类型
typedef struct{
int q[20]
-[imported] map of the number of vertices N, Vertex map of the relationship between the starting point and end point A and B [output] if A to B without path then exporting "There is no path" Otherwise output A to B on the path vertices [storage structure] plan adopted adjacency matrix of storage. [Algorithm for the basic idea] BFS way from the vertex A, A visit followed with adjacent vertices VA1, VA2 ,..., VAK, visiting times, if not visit B, continue to visit with the VA1 adjacent vertices VA11, VA12 ,..., VA1M. VA2 and then
- 2022-01-25 22:50:29下载
- 积分:1
-
俄罗斯方块游戏,无
俄罗斯方块游戏,无-Tetris games, no
- 2023-07-03 17:15:04下载
- 积分:1
-
VC++实现菜单功能,适合初学者学习使用
VC++实现菜单功能,适合初学者学习使用-VC++ Realize menu function, suitable for beginners learning to use
- 2022-10-06 10:00:02下载
- 积分:1
-
阿苏大嫂风纪扣速度货方思考定界符会三大件开发哈可阿库房萨毒贩...
阿苏大嫂风纪扣速度货方思考定界符会三大件开发哈可阿库房萨毒贩-Aso sister-in-law wind speed cargo buckle Ji Thinking delimiter will be the development of Kazakhstan三大件can the Arab-Israeli drug traffickers Treasury Sa
- 2023-08-19 07:45:03下载
- 积分:1
-
这是用C#语言,.net平台所做的一个弹球的小游戏,是一个不错的了解windows编程的东西。...
这是用C#语言,.net平台所做的一个弹球的小游戏,是一个不错的了解windows编程的东西。-This is the C# language. Net platform doing a little game of pinball, is a good understanding of windows programming things.
- 2022-02-24 13:03:10下载
- 积分:1
-
Apriori algorithm can be realized. The algorithm will be deposited into the arra...
能够实现Apriori算法。该算法将数据存入数组中进行操作。-Apriori algorithm can be realized. The algorithm will be deposited into the array of data to operate.
- 2022-04-07 18:53:44下载
- 积分:1
-
求根MUSIC空间谱估计算法
传统空间谱估计算法当中,求根Root-MUSIC算法不仅计算量小,而且估计性能优越,尤其是在低信噪比时,相比MUSIC的性能又不小的提升。
- 2022-10-16 10:45:03下载
- 积分:1
-
演示把几个文件打包成一个文件并且释放
演示把几个文件打包成一个文件并且释放-demo packages combine several documents into one document and release
- 2023-02-04 09:30:04下载
- 积分:1
-
小世界网络的试验程序!可以观察小世界网络的生成过程和结果!...
小世界网络的试验程序!可以观察小世界网络的生成过程和结果!-small world network testing procedures. Can observe small world network formation process and results!
- 2022-02-05 08:48:37下载
- 积分:1