(以下为先序遍历建立二叉树)
void CreateBiTree(BiTree * root)
{
char ch;
ch = getchar();
if(ch == ' ') //空格代表为空
- root = NULL;
else
{ - root = (BiTree)malloc(sizeof(BiTNode));
(*root)->data = ch;
CreateBiTree(&((*root)->Lchild));
CreateBiTree(&((*root)->Rchild));
}
}
(以下为先序遍历建立二叉树)
void CreateBiTree(BiTree * root)
{
char ch;
ch = getchar();
if(ch == ' ') //空格代表为空