CSC403: Tree code: "Threaded" parameter with non-nullable pointer 0 [27/29] Previous pageContentsNext page

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

"Threaded" parameter with non-nullable pointer.

Previous pageContentsNext page