Hello,
i have written the code for checking a given tree is strict binary or not.
i tried the following code but i am not getting the correct result.
and i unable to understand how to check.
int strict ( BST_t *p ){
if( p == NULL )
return 1;
else if( ( p->right == NULL && p->left == NULL ) || ( p->right != NULL && p->left != NULL ) )
{
return strict( p->left );
return strict( p->right );
}
else
return 0;
}
in this case the program is returning from
strict(p->left) only its not entering strict (p->right).
how to make the function enter both the links.
the other thing is if the tree is empty ( no nodes at all) then is it a strict binary tree.
please do the need i have been trying for this for few days but unable to get the idea..