Tree Path problem

Revision en1, by W--o_o--W, 2018-11-24 17:24:38

Hello,

I came up with the following problem but I'm not sure if it is possible to solve it in less than O(n2), any ideas?

You are given a weighted tree with n nodes and you are allowed to swap the costs (1 ≤ cost ≤ n) of two edges at most once such that the sum of all paths in the tree is maximum.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English W--o_o--W 2018-11-24 17:24:38 337 Initial revision (published)