Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems Introduction To Databases And Data Warehouses

Authors: Nenad Jukic, Susan Vrbsky, Svetlozar Nestorov

1st Edition

1943153191, 978-1943153190

More Books

Students also viewed these Databases questions

Question

How does information overload impact your communications?

Answered: 1 week ago