Problem 3: Trees (100 + 100 + 200 + 100 + 100 pts)
Recall that the tree
abstract data types mentioned in class, can be recursively defined using a root node and (sub)trees.
Tree ADT has one constructor:
tree(label, branches=[])
: Creates a tree with the given label and branches.
We also have the following default selectors in order to get the information for each tree:
label(tree)
: returns thetree
's label.branches(tree)
: returns thetree
's branches.is_leaf(object)
: returns the if atree
is a leaf.