//删除叶子节点 
void Delete_leaf(BTNode *t){
    if(t==null) return;
    if(t->lchild!=null){
        BTNode* tlchild=t->lchild;
        if(tlchild->lchild==null && t->trchild==null){
            free(tlchild);
            t->lchild=null;
        }
    }
    if(t->rchild!=null){
        BTNode *trchild=t->rchild;
        if(trchild->lchild==null && trchild->rchild==null){
            free(trchild);
            t->rchild=null;
        }
    }
    Delete_leaf(t->lchild);
    Delete_leaf(t->rchild);
}

相关文章:

  • 2021-10-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-17
猜你喜欢
  • 2021-08-21
  • 2021-06-27
  • 2021-10-18
  • 2021-05-27
  • 2022-12-23
  • 2021-06-25
  • 2022-03-05
相关资源
相似解决方案