Given a maze of tunnels which are structured as a n-ary tree starting from a single entry point, find the minimum cost to visit all the tunnel paths at least once. There is a cost involved in walking through a tunnel. Each time you cross that tunnel, the cost is added.

Minimum cost is 4
A
|_ A.1
|_ A.2
   |_ A.2.1

Minimum cost is 19 for below tree
A
|_ B
   |_ B.1
   |_ B.2
   |_ B.3
|_ C
   |_ C.1
|_ D
   |_ D.1
   |_ D.2
   |_ D.3
      |_ D.3.1
Comments (6)