divide and conquer on trees (by centroid)