手机版

恒生电子笔试题3(6)

时间:2025-07-07   来源:未知    
字号:

恒生电子笔试题

中,并返回非0。如果没找到可以到达终点的路径,返回0。返回的"maze"中除了路径之外其它都清空为0。如下表:

struct NODE { int row; int col; int value; struct NODE* pNodes[8]; int nNeighborNum; };

struct PATH { struct NODE* pCur; struct NODE* pNext; };

void init_maze(int maze[8][8], struct NODE maze_map[8][8]) { // save maze info into maze_map }

int check_end(struct NODE* pNode) { // check if the end position is beside }

struct NODE* get_neighbor(struct NODE** pNode, struct PATH cur) { // get neighbor node which has not been checked }

void add_checked_neighbor(struct NODE** pNode, struct NODE* pNeighbor) { // add neighbor node to the checked node list, // the next time get_neighbor() will not choose it }

int path(int maze[8][8]) { struct PATH path[64] = {}; struct NODE maze_map[8][8] = {}; struct NODE* node_examed[64] = {}; init_maze(maze, maze_map); int nCurPath = 0; path[nCurPath].pCur = &maze_map[0][0]; path[nCurPath].pNext = NULL; add_checked_neighbor(node_examed, &maze_map[0][0]);

恒生电子笔试题3(6).doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
×
二维码
× 游客快捷下载通道(下载后可以自由复制和排版)
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能出现无法下载或内容有问题,请联系客服协助您处理。
× 常见问题(客服时间:周一到周五 9:30-18:00)