0
$\begingroup$

Let T be a full binary weighted tree. For a node v in T, the cost of going right is a i.e w(v, v.right) = a while w(v, v.left) = b

How do I find optimal paths to all leaves from the root. I don't think classical graph traversals are helpful in this context as I don't need to visit all nodes.

$\endgroup$
1
  • $\begingroup$ I'm not sure what you mean. In a tree, there's only one way to get from $A$ to $B$ so all routes that visit all leaves have the same cost. $\endgroup$ Apr 30, 2018 at 10:12

1 Answer 1

1
$\begingroup$

Hint: How many paths are there from a given leaf to the root?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.