/*Pass address of root node in function argument...
count_leaf(root);*/
count_leaf(struct bintree *t)
{
int c1 = 0, c2 = 0;
if(t!=NULL)
{
if(t->left == NULL && t->right == NULL)
c1 = 1;
c2 = retun (count_leaf(t->left)+c1);
return (count_leaf(t->right)+c2);
}
return 0;
}
0 comments:
Post a Comment