看到这。。。 [Copy to clipboard]View Code CPP
// Children-Sibling-Tree-define.h 树的二叉链表(孩子兄弟)存1 储表示。 2 // typedef char TElemType; 3 typedef struct CSNode 4 { 5
6 TElemType data; //TElemType定义在后边。
7 CSNode *firstchild,*nextsibling;
}CSNode,*CSTree;
[Copy to clipboard]View Code CPP
1 // Children-Sibling-Tree-operations.h 树的孩子兄弟存储表示2
3 的常用操作。
4
5 Status InitTree(CSTree &T)
6 { //构造空树T。 7
8 T=NULL;
9 return OK;
10 }
11
12 void DestroyTree(CSTree &T)
13 { //销毁树T。 14
15 if(T)
16 {
17 if(T->firstchild)
18 DestroyTree(T->firstchild);
19 if(T->nextsibling)
20 DestroyTree(T->nextsibling);
21 free(T);
22 T=NULL;
23 }
24 }
25
26 typedef CSTree QElemType;
27 #include"LinkQueue-define.h"