Question: Python Question Write a function named find(tree, to_find) function which is passed two parameters: a BinaryTree object and a value which has the same type
Python Question
Write a function named find(tree, to_find) function which is passed two parameters: a BinaryTree object and a value which has the same type as the data stored in the binary tree nodes. The function searches the nodes of the parameter binary tree and returns True if the to_find is present in a node of the tree, False otherwise. For example, given the following tree,

the code:
print(find(my_tree, 65))
prints
True
The function header is:
def find(tree, to_find):
For example:
| Test | Result |
|---|---|
print(find(my_tree, 65)) | True |
print(find(my_tree, 1)) | False |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
