Question: there is no parameters for the function as it won work when it comes to printing it. I will add the class below as well

there is no parameters for the function as it won work when it comes to printing it. I will add the class below as well in python:

there is no parameters for the function as it won work whenit comes to printing it. I will add the class below as

class BinaryTree: def __init__(self, data, left=None, right=None): self.__data = data self._left = left self._right = right def insert_left(self, new_data): if self._left == None: self._left = BinaryTree(new_data) else: tree = BinaryTree (new_data, left=self. _left) self._left = tree def insert_right(self, new_data): if self._right == None: self._right = BinaryTree(new_data) else: tree = BinaryTree (new_data, right=self._right) self._right = tree def get_left(self): return self._left def get_right(self): return self._right def set_data(self, data): self.__data = data def get_data(self): return self.__data def set_left(self, left): self. _left = left def set_right (self, right): self._right = right Consider the following nested list: [78, [68, [95, None, None], [39, None, None]], [11, [19, None, None], [77, None, None]]] The nested list format always uses a list of length three to represent a binary tree. The first item in the list is the data value of the root, the second item in the list is the left subtree (this may be None if the left subtree is empty, or it may be a nested list) and the third item in the list is the right subtree (this may be None if the right subtree is empty, or it may be a nested list). Define a function called create_sample_tree () which builds and returns the above binary tree: Note: you can assume that the BinaryTree class and the print_tree() function are given. For example: Test Result b_tree = create_sample_tree() print_tree (b_tree, 0) 68 78 (L) (L) (R) (R) (L) (R) 95 39 11 19 77 Answer: (penalty regime: 0, 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50 %) Reset answer 1 def create_sample_tree(): 2

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!