文件名称:Eidffakght
- 所属分类:
- 数据结构常用算法
- 资源属性:
- [Windows] [Visual C] [源码]
- 上传时间:
- 2012-11-26
- 文件大小:
- 13kb
- 下载次数:
- 0次
- 提 供 者:
- 刘**
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容均来自于网络,请自行研究使用
利用BFS算法解八数码问题
在3*3的方格上放着1-8数码,有一空格为0变化规则为空格可以和上,下,右,左四个相邻的数字互换,
至到和目标状态相等,
每一种状态用一个结点表示
而每个结点每次变化最多有四种结点,将这些结点依次入队列中,
例如初始结点S0,入队列后出队,将S0变化最多产生的四种结点S01,S02,S03,S04依次入队列中,
当S01出队后,产生的四种结点S11,S12,S13,S14(实际上不会有四种结点)依次入队,
每次出队时与结束结点相比较,如果相等则退出,
为了,防止已经入队的结点再次入队,(这样会造成列循环),将每次入队的结点设置一个标识号,
四种变化即:向上,向下,向右,向左,我们要求向上和向下互斥,向右和向左互斥-use BFS Algorithm for eight in digital 3* 3, the box copy digital 1-8, 0 for a change in spacing rules for space and can, under the right, left four adjacent digital exchange, and to target state of the same, each state with a node and each said nodes changes each have up to four nodes, and these nodes will be followed into the queue, for example, the initial node S0, out into the queue after the teams will have the most S0 changes of the four nodes S01, S02, SO3, S04-followed cohort, when S01 out teams after the four nodes S11 , S12, S13, S14 (not, in fact, four nodes), followed by the team, each team up with the end node comparison, if the same were to withdraw from, in order to prevent the team has the guitar again joined the team, (this will lead out cycle), each of the team set up a
在3*3的方格上放着1-8数码,有一空格为0变化规则为空格可以和上,下,右,左四个相邻的数字互换,
至到和目标状态相等,
每一种状态用一个结点表示
而每个结点每次变化最多有四种结点,将这些结点依次入队列中,
例如初始结点S0,入队列后出队,将S0变化最多产生的四种结点S01,S02,S03,S04依次入队列中,
当S01出队后,产生的四种结点S11,S12,S13,S14(实际上不会有四种结点)依次入队,
每次出队时与结束结点相比较,如果相等则退出,
为了,防止已经入队的结点再次入队,(这样会造成列循环),将每次入队的结点设置一个标识号,
四种变化即:向上,向下,向右,向左,我们要求向上和向下互斥,向右和向左互斥-use BFS Algorithm for eight in digital 3* 3, the box copy digital 1-8, 0 for a change in spacing rules for space and can, under the right, left four adjacent digital exchange, and to target state of the same, each state with a node and each said nodes changes each have up to four nodes, and these nodes will be followed into the queue, for example, the initial node S0, out into the queue after the teams will have the most S0 changes of the four nodes S01, S02, SO3, S04-followed cohort, when S01 out teams after the four nodes S11 , S12, S13, S14 (not, in fact, four nodes), followed by the team, each team up with the end node comparison, if the same were to withdraw from, in order to prevent the team has the guitar again joined the team, (this will lead out cycle), each of the team set up a
(系统自动生成,下载前可以参看下载内容)
下载文件列表
Eight
.....\Eight.cpp
.....\Eight.dsp
.....\Eight.dsw
.....\Eight.ncb
.....\Eight.opt
.....\Eight.plg
.....\ReadMe.txt
.....\StdAfx.cpp
.....\StdAfx.h
.....\算法说明.txt
.....\Eight.cpp
.....\Eight.dsp
.....\Eight.dsw
.....\Eight.ncb
.....\Eight.opt
.....\Eight.plg
.....\ReadMe.txt
.....\StdAfx.cpp
.....\StdAfx.h
.....\算法说明.txt