Trees
Q1: Prune Min
Write a function that prunes a
Tree
t
mutatively.t
and its branches always have zero or two branches. For the trees with two branches, reduce the number of branches from two to one by keeping the branch that has the smaller label value. Do nothing with trees with zero branches.Prune the tree in a direction of your choosing (top down or bottom up). The result should be a linear tree.