精选范本,供参考!
C 语言递归实现二叉树的建立,先序,中序,后序遍历操作及结点数
和树的高度计算
#include <stdio.h>
#define ElemType char
//节点声明,数据域、左孩子指针、右孩子指针
typedef struct BiTNode{
char data;
struct BiTNode *lchild,*rchild;
}BiTNode,*BiTree;
//先序建立二叉树
BiTree CreateBiTree(){
char ch;
BiTree T; BiTree T;
if(ch=='#')T=NULL;
else{
T = (BiTree)malloc(sizeof(BiTNode));