有没有大神说一下为什么注释里面的不能求二叉树叶子的个数?
int CountNode_Leaf(pBTNode t)
{
int i = 0;
if (!t) return 0;
int l= CountNode_Leaf(t->LTree);
int r =CountNode_Leaf(t->RTree);
//if (!t->LTree && !t->RTree)
//{
// //printf("00==%d",i);
// i = l + r + 1;
// return i;
//}
i = l + r + 1;
if (t->LTree || t->RTree) i--;
return i;
}
半个灰二
2020/12/05 11:44- c++
- c语言
- 点赞
- 收藏
- 回答
0个回复
