登录
首页 » C/C++ » main

main

于 2018-07-03 发布 文件大小:1KB
0 35
下载积分: 1 下载次数: 0

代码说明:

  以一个m*n的长方阵表示迷宫,0和1分别表示迷宫中的通路和障碍。设计一个程序,对任意设定的迷宫,求出一条从入口到出口的通路,或得出没有通路的结论。 1.基本要求 (1)首先实现一个以链表作存储结构的栈类型,然后编写一个求解迷宫的非递归程序。求得的通路以三元组(i,j,d)的形式输出。其中:(i,j)指示迷宫中的一个坐标,d表示走到下一坐标的方向。如下图所示迷宫。从入口(1,1)到出口(8,8)的求解结果如下: (1,1)(1,2),(2,2)(3,2)(3,1)(4,1)(5,1)(5,2)(5,3)(6,3)(6,4)(6,5)(5,5)(4,5)(4,6)(4,7)(3,7)(3,8)(4,8)(5,8)(6,8)(7,8)(8,8)(The labyrinth is represented by a m*n rectangular array. 0 and 1 represent the pathways and obstacles in the labyrinth respectively. Design a program for any set of maze, find a way from the entrance to the exit, or draw no conclusion of the path. 1. basic requirements (1) first implement a stack type with linked list as storage structure, then write a non recursive procedure to solve the maze. The path obtained is output in the form of three tuple (I, J, d). Among them: (I, J) indicates a coordinate in the labyrinth, and D indicates the direction of going to the next coordinate. As shown in the labyrinth below. The results obtained from the entrance (1, 1) to the outlet (8, 8) are as follows: (1, 1) (1, 2), (2, 2) (3, 2) (3, 1) (4, 1) (4, 1).)

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • 696524资源总数
  • 103930会员总数
  • 47今日下载