Send to a Friend

steeveage's avatar

How do I find a minimum subtree?

Asked by steeveage (3points) October 12th, 2009

Given an n-ary tree T where each node has a value V, find the smallest subtree S that contains all values in a list L.

What’s the optimal solution to this? One way I can think of doing this is to do a tree traversal starting from the root to find all values of L and continue to do this for every subtree until it is no longer true. However this is O(n^2), I wonder if there is anything faster.

Using Fluther

or

Using Email

Separate multiple emails with commas.
We’ll only use these emails for this message.