1 struct BiTree
 2 {
 3     struct BiTree *lchild;
 4     struct BiTree *rchild;
 5 };
 6 
 7 int Node(struct BiTree *T)
 8 {
 9     if(T == NULL)
10         return 0;
11     return 1+Node(T->lchild)+Node(T->rchild);
12 }
13 
14 int Leaf(struct BiTree *T)
15 {
16     if(T==NULL)
17         return 0;
18     if(T->lchild == NULL && T->rchild == NULL)
19         return 1;
20     return Leaf(T->lchild)+Leaf(T->rchild);
21 }

 

相关文章:

  • 2021-10-18
  • 2021-08-29
  • 2022-12-23
  • 2022-12-23
  • 2021-11-12
  • 2022-12-23
  • 2021-09-13
猜你喜欢
  • 2021-08-21
  • 2021-07-01
  • 2021-09-03
  • 2022-02-01
  • 2021-09-17
相关资源
相似解决方案