先序创建二叉树

 09 void CreateTree(BiTree *T) {
 10     char ch;
 11     scanf("%c",&ch);
 12     if(ch == '#') {
 13         *T = NULL;
 14         return;
 15     }
 16     else {
 17         *T = (BiTree)malloc(sizeof(BiTNode));
 18         if(*T== NULL) exit(-1);
 19         (*T)->data = ch;
 20         CreateTree(&(*T)->lchild);
 21         CreateTree(&(*T)->rchild);
 22     }
 23 }
先序创建二叉树
(1)利用递归思想,先创建根结点,再创建左子树,再创建右子树。
(2)创建根结点的步骤,输入一个元素,该元素是终止元素,根空,结束所有,不是创建根结点
(3)递归创建左子树,创建右子树。
原文地址:https://www.cnblogs.com/joyeehe/p/7878626.html