title: Finding The Maximum Weight on A Tree
body: <p>I have a tree with <code>N</code> nodes and each edge has some weight. I have to find, for all pairs <code>(u,v) 1&lt;=u&lt;=N 1&lt;=V&lt;=N</code>, the maximum weight in the path from <code>U</code> to <code>V</code>. How can I find the total sum of the maximum weight for every  pair <code>(U,V)</code>?</p>