递归创建先序序列二叉树

void Creat(BTNode *&T)
{
    char ch;
    cin >> ch;
    if ((ch - '#') == 0)
        T = NULL;
    else
    {
        T = (BTNode *)malloc(sizeof(BTNode));
        T->data = ch;
        Creat(T->lchild);
        Creat(T->rchild);
    }
}

你可能感兴趣的:(递归,二叉树)