Hey
i want to create a method which counts the nodes from a binary tree that have exactly one child
i did that but it returns error :S
Can anyone tell me what's going wrong ??
Thanks in advance
//Count nodes from BinaryTree1 that have exactly one child
public static int countNodesOne(BinaryTree2 node)
{
if (node == null)
{
return 0;
}
else
{
if (int leftCount = countNodesOne(node.left = 1))
{
else if (int rightCount = countNodesOne(node.right = 1)
{
return leftCount + rightCount;
}
}
}
}