Spanning Tree

Limits: 1s, 512 MB

There are N nodes in a tree. You can start from any node of that tree and you have to come back to the starting node. In that path you have to visit all others the node also. You can visit a node multiple times. But you have to do it as fast as possible. It takes 1 unit time to move from one node to its adjacent node. Suppose the smallest time to travel from any node in the tree and come back that starting node while having visited all others node is T.


This is a companion discussion topic for the original entry at https://toph.co/p/spanning-tree