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$
  • $\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$ – David Richerby Apr 30 '18 at 10:12
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, privacy policy and cookie policy

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