1.双亲表示法:
#define MAX_TREE_SIZE 100
typedef struct PTNode {
ElemType data;
int parent;
}PTNode;
typedef struct {
PTNode nodes[MAX_TREE_SIZE];
int r,n;
}
![树的双亲表示法](https://i-blog.csdnimg.cn/blog_migrate/f30c5ec717f8058f02215cd6d75a73e6.png)
树的双亲表示法示例
2.树的孩子链表存储表示
typedef struct CTNode {
int child;
struct CSNode *next;
}* ChildPtr;
typedef struct {
Elemtype data;
ChildPtr firstchild;
}CTBox;
typedef struct {
CTBox nodes[MAX_TREE_SIZE];
int n, r;
}CTree;
![这里写图片描述](https://i-blog.csdnimg.cn/blog_migrate/876112d0266610aed79be975e53cf6db.png)
树的孩子链表表示法示例
3.树的孩子兄弟表示法
typedef struct CSNode {
ElemType data;
struct CSNode *firstchild, *nextsibling;
}CSNode, *CSTree;
![这里写图片描述](https://i-blog.csdnimg.cn/blog_migrate/e9c770cf20a021fcbda3ccfeda96aa94.png)
树的二叉链表表示法示例