How do I find a minimum subtree?
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.
This question is in the General Section. Responses must be helpful and on-topic.