CSC403: Tree code: Negligent! [24/29] Previous pageContentsNext page

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

What's wrong with this code?

Previous pageContentsNext page