CSC403: Tree code: Local variables don't matter [19/29] Previous pageContentsNext page

    public int size () {
        return size (root);
    }
    private static int size (Node x) {
        if (x == null) return 0;
        return size (x.left) + size (x.right) + 1;
    }

From a compiler point of view, this code is identical to the previous version, since this will be translated into SSA.

Previous pageContentsNext page