📄 m_list.h
字号:
// m_List.h: interface for the m_List class.
//=======================================================================
// Description : 综合链表类(包括基本的建立链表,插入,删除,查找,打印,长度等)
// Parameters : 结合状态空间的定义等,用于A*算法或其他应用,
//但本程序有一个缺点就 是没有释放节点 。
// Supplement : 无
//========================================================================
#include "maze.h" // Added by ClassView
#include "list_node1.h" // Added by ClassView //链表的结构类
#if !defined(AFX_M_LIST_H__F76272C7_6425_48B5_96C3_6F1B839ACD66__INCLUDED_)
#define AFX_M_LIST_H__F76272C7_6425_48B5_96C3_6F1B839ACD66__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class listnode //链表节点类
{
public:
static int Destroy(list_node *list_head1);
list_node * min_fn;
//链表的函数 集合
//int step;//定一步数
//extern list_node m_list; //建立一个 自己用的 链表 用于存放 a*搜到的 路径
//extern list_node open_list;
//extern list_node closed_list;
//extern list_node sub_nodes;
//=======================================================================
// Description : 构造函数,创建双向链表的一个结点,并赋值当前结点为空。
// Parameters : 其中的数据为int类型的数据,由于表头结点中的数据不会被使用,
// 因此该数据可以为任何不在后继结点中使用的数据即可。
// Returns : list_node *型的指针
// Supplement : 无
//use========================================================================
static list_node * create_node(int row_1,int collum_1,int f_n_1);
//测试链表的 函数 在本程序中没用
static int openlist(list_node * open_list);
//=======================================================================
// Description : 构造函数,创建一个双向链表,其实就是创建创建链表的头指针。
// Parameters : int类型的数据,由于表头结点中的数据不会被使用,
// 因此该数据可以为任何不在后继结点中使用的数据即可。
// Supplement : 无
//========================================================================
//创建链表use
static int create_list(int head1,int head2,int head3); //参数给出表头结点数据 (表头结点不作为存放有意义数据的结点)
//list_node del_node2(list_node list_head1,list_node node_current);
//插入新结点,总是在表尾插入; 返回表头结点use
static list_node * insert_node(list_node * node_temp, int data1,int data2,int data3); // 参数1是链表的表头结点,参数2是要插入的结点(结点数据为data)
//插入新结点,总是在表尾插入; 返回表头结点
static list_node * insert_node2(list_node * list_head2,list_node * node_temp); // 参数1是链表的表头结点,参数2是要插入的结点(结点数据为data)
static list_node * find_closed(list_node * node_temp1, int target1,int target2); // 参数1是链表的表头结点,参数2是要查找的结点(其中结点数据为target)
//===============================================================================
// Description : 删除当前结点。
// Parameters : 第一个是表头地址,第二个是要删的节点的地址
// Returns : list_node *型的指针
// Supplement : 无
//use================================================================================
static int del_node2(list_node * list_head1,list_node * node_current);
//===============================================================================
// Description : 该函数判断双向链表是否为空。
// Parameters : 无
// Returns : 若链表为空则返回1,否则返回0。
// Supplement : 无
//use================================================================================
static int IsMyListEmpty(list_node * link_temp);
//============================================================================
// Description : 该函数从链表开始位置寻找结点数据等于fn的结点。
// Parameters : 无
// Returns : 若找到满足条件的结点则返回指向该结点指针,
// Supplement : 无
//use============================================================================
static list_node * listnode::find_fn(list_node * node_temp); // 参数1是链表的表头结点
//=======================================================================
// Description : 迷宫A*搜索算法中的重新计算子孙节点的fn值程序
// Parameters :链表定义,结合状态空间的定义等,已于上面完成
// Returns : list_node *型的指针
// Supplement : 无
//========================================================================
static list_node * son_fn(list_node * temp,int dg);
//=======================================================================
// Description : 迷宫A*搜索算法程序
// Parameters : 链表定义,结合状态空间的定义等,已于上面完成
// return : list_node *型的指针
// Supplement : 无
//use========================================================================
//int a_search(int a[][11],CPoint s_n,CPoint s_g);
/*typedef struct state_def /* 状态空间定义(其中包含g-n,h-n,fn等)
{
int s_row;
int s_collum;
int s_f_n;
int s_g_n;
int s_h_n;
} statenode, * state_define;
int step,dg_n; /* 定义总步数
int sum,path[100][3];
int level;
m_List* open_list();
*/
listnode();
virtual ~listnode();
};
#endif // !defined(AFX_M_LIST_H__F76272C7_6425_48B5_96C3_6F1B839ACD66__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -