Question
please help out class BTNode: '''Binary Tree Node class - do not modify''' def __init__(self, value, left, right): '''Stores a reference to the value, left
please help out
class BTNode: '''Binary Tree Node class - do not modify''' def __init__(self, value, left, right): '''Stores a reference to the value, left child node, and right child node. If no left or right child, attributes should be None.''' self.value = value self.left = left self.right = right
class BST: def __init__(self): # reference to root node - do not modify self.root = None
def insert(self, value): '''Takes a numeric value as argument. Inserts value into tree, maintaining correct ordering. Returns nothing.''' pass
def search(self, value): '''Takes a numeric value as argument. Returns True if its in the tree, false otherwise.''' pass
def height(self): '''Returns the height of the tree. A tree with 0 or 1 nodes has a height of 0.''' pass
def preorder(self): '''Returns a list of the values in the tree, in pre-order order.''' pass
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started