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