Use a new parameter, nv, which refers to the number of nodes in the subtree rooted at v.