开发者社区> 问答> 正文

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

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

展开
收起
知与谁同 2018-07-21 16:37:16 1485 0
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
    赞同 展开评论 打赏
问答分类:
问答标签:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
数据+算法定义新世界 立即下载
袋鼠云基于实时计算的反黄牛算法 立即下载
Alink:基于Apache Flink的算法平台 立即下载