First of all, I swear this is not homework, it\'s a question I was asked in an interview. I think I made a mess of it (though I did realise the solution requires recursion).
Implement the method:
public static int countOneChild(Node root) { ... }
that counts the number of internal nodes in a binary tree having one child. Add the function to tree.java program.
tree.java