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

uva 10459 - Find all the best and worst roots of an undirected unweighted tree.

$
0
0

Given an undirected tree, how can I find out those vertices which when taken as the root of the tree will minimize the depth of the tree. Similarly, I want to find those vertices which when taken as the root of tree, will maximize the depth of tree. I want to answer this for a general tree in linear time. (Linear in the number of vertices of the tree)

Uva 10459 link to the question


Viewing all articles
Browse latest Browse all 40121


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