Hi
We have a problem on a tree.
Imagine order of our algorithm is:
Sigma x(i) ^ 2
That if we define sz[v] as number of vertices in subtree of v, x(i) is number of different sz[u] between v's children.
It's easy to see it's O(n * sqrt(n)).
But as I saw it was realy fast I think it's just better.
Any idea?