Question: Write a recursive private method called countOneChildLeaf Nodes to be considered within the BinaryTree class and has one parameter node of type Node and
Write a recursive private method called countOneChildLeaf Nodes to be considered within the BinaryTree class and has one parameter node of type Node and returns the number of nodes having one child or leaf nodes in the binary tree. This method is being called by a public method called countOneChildLeaf which has no parameter and returns the number of nodes having one child or leaf nodes in the binary tree. The public method is public int countOneChildLeaf () {return countOneChild LeafNodes (root); } The head of the private method is privat int countOneChild Leaf Nodes ( Node node)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
