23: Even More Recursion

Submit this homework using Gradescope. You can type up your answers, or write legibly and scan them. Do not attempt to submit a paper copy in class, as it will not be accepted.


Suppose you have a tree composed of Nodes:

public class Node<E> {
    public E data;
    public Node<E> left;
    public Node<E> middle;
    public Node<E> right;
}

where each node has up to three children.

(1 point) Write a recursive int size(Node<E> node) method that returns the number of non-null Nodes in the tree rooted at node.