Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 39796

How to find the most SUITABLE root for a given tree?

$
0
0

Hi,

There are a number of problems involving trees in which we have to find LCA, distances etc. Such problems require that a node is assigned as a root node of the tree.

Like in case of LCA-

Dist(a,b) = Dist(a,root) + Dist(b,root) - 2*Dist(LCA(a,b), root)

Are there any known, good methods for finding out the most optimal root for the tree(As any node can be considered as a root).

Thanks


Viewing all articles
Browse latest Browse all 39796

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>