Centroid Decomposition: Divide and Conquer on Trees
Standard divide and conquer works beautifully on arrays because splitting in half guarantees O(log n) depth. Trees don’t offer this luxury. A naive approach—picking an arbitrary node and recursing on…
Read more →