开发者社区 问答 正文

编写递归算法,将二叉树销毁

编写递归算法,将二叉树销毁

展开
收起
知与谁同 2018-07-21 16:37:16 1501 分享 版权
1 条回答
写回答
取消 提交回答
  • struct node
    {
    char data;
    struct node *lchild;
    struct node *rchild;
    };

    void distroyTree(struct node* &root)
    {
    if(root)
    {
    distroyTree(root->lchild);
    distroyTree(root->rchild);
    root = NULL;
    }
    }
    2019-07-17 22:55:13
    赞同 展开评论
问答分类:
问答标签:
问答地址: