CSC403: Tree code: Is this correct? [13/29] Previous pageContentsNext page

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

Is this correct?

Previous pageContentsNext page