Suppose we add this function foo() to the class Tree that implements search trees. For a name mytree with a value of type Tree, what would mytree.foo() compute?
def foo(self): if self.isempty(): return(0) elif self.isleaf(): return(1) else: return(self.left.foo() + self.right.foo()))
The number of nodes in mytree
The largest value in mytree.
The length of the longest path from root to leaf in mytree.
The number of leaves in mytree.
Answers
Answered by
0
Answer:
Explanation:
Very long question....
Similar questions