Tree Properties & Traversals

Answer & solution
Official answer: D
Step 1: A NULL pointer returns zero. A node with no child contributes one for itself, identifying a leaf. A node with children contributes only the recursive count from its child list, not one for itself. Step 2: The rightSibling recursion adds the counts of the remaining sibling subtrees. It does not test whether a sibling exists as a property to count. Step 3: Inductively each forest call counts exactly its leaves; at the root, whose sibling pointer is NULL, this is the entire tree's leaf count, D. The recurrence adds branches rather than taking a maximum, so it does not compute height.