Similar questions 2 more →
Tree Properties & Traversals


Answer & solution
Answer: D (no official key was published)
1. A leaf returns zero. A node with a child takes one plus that child’s recursively computed value; with two children it takes the maximum.
2. Induction gives the maximum number of edges from the node to a descendant leaf, i.e. height measured in edges. The null check returns zero but no missing child adds an edge.
3. The code does not count nodes or leaves.
4. Teaching check: A singleton tree returns zero, immediately excluding both total-node and leaf counts. A two-edge chain returns two. The recursive maximum chooses the deepest child path, while adding one accounts for the edge from the current node to that child.