The Binary Tree Abstract Data Type has the following description of methods:
BinaryTree(key)
constructs a binary tree with value key and no childrenget_root_val()
returns the root value of this particular sub-treeset_root_val(val)
modifies the root value of this particular sub-treeget_left_child()
returns the subtree that is the left child of the current rootget_right_child()
returns the subtree that is the right child of the current rootinsert_left(val)
creates a new binary tree and installs it as the left child of the current node, moving the current child down one level in the treeinsert_right(val)
creates a new binary tree and installs it as the right child of the current node, moving the current child down one level in the treeIn a program binary_tree_class.py
write a class BinaryTree
that implements the Binary Tree ADT. The class will need to include the following constructor and methods:
__init__(key)
get_root_val()
set_root_val(new_val)
get_left_child()
get_right_child()
insert_left(new_left_child)
insert_right(new_right_child)
__str__()