Hints for Question 2

Use convergecast. Every processor sends a message to its parent containing two values: the sum of distances from its descendants to itself, and the number of processors in the subtree rooted at the processor.