一:双亲表示法
/*双亲表示法*/
typedef struct PTNode /*节点结构*/
{
TElemType data; /*节点数据域*/
int parent; /*双亲的位置*/
}PTNode;
typedef struct /**/
{
PTNode nodes[MAX_TREE_SIZE]; /*可存储节点个数*/
int r,n; /*根的位置以及节点个数*/
}PTree;
二:孩子表示法
/*树孩子表示法*/
typedef struct CTNode /*孩子节点的结构*/
{
int child;
struct CTNode *next;
}*ChildPtr;
typedef struct /*表头结构*/
{
TElemType data;
ChildPtr firstchild;
}CTBox;
typedef struct /*树的结构*/
{
CTBox nodes[MAX_TREE_SIZE];
int r, n;
}CTree;
三:双亲孩子表示法
/*树双亲孩子表示法*/
typedef struct CTNode /*孩子节点的结构*/
{
int child;
struct CTNode *next;
}*ChildPtr;
typedef struct /*表头结构*/
{
TElemType data;
int parent;
ChildPtr firstchild;
}CTBox;
typedef struct /*树的结构*/
{
CTBox nodes[MAX_TREE_SIZE];
int r, n;
}CTree;
四:孩子兄弟表示法
在这里插入代码片
五:二叉树的存储结构
https://blog.csdn.net/qq_38158479/article/details/104107974