Create a recursive algorithm that given the TreeNode structure shown below, it calculates the number of leaves of a tree. The signature of the method is as follows: public static int getLeaves(TreeNode node) The TreeNode structure is as follows: public class TreeNode<T> { public <T> content; public TreeNode<T> leftChild; public TreeNode<T> rightChild;
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!