class BST: def __init__(self, root = None): if root != None: root.setparent(None) self.__root = root def getroot(self): # Returns the root node of the tree ####################################################################### # Remove the pass and write your code ####################################################################### pass ####################################################################### # End code ####################################################################### def setroot(self, node): # Sets the root node of the tree ####################################################################### # Remove the pass and write your code ####################################################################### pass ####################################################################### # End code ####################################################################### def insertnode(self, node): # Inserts a node to the correct position in a BST. A success returns true and failure returns false. ####################################################################### # Remove the pass and write your code ####################################################################### pass ####################################################################### # End code ####################################################################### def searchnode(self, searchkey): # Search the BST for a node with searchkey. If found returns the first node with searchkey and failure returns false. ####################################################################### # Remove the pass and write your code ####################################################################### pass ####################################################################### # End code ####################################################################### def removekey(self, removekey): node = self.searchnode(removekey) self.__removenode(node) def __removenode(self, node): # Removes a node from the BST. This method uses the __successornode and __replacechild method. ####################################################################### # Remove the pass and write your code ####################################################################### pass ####################################################################### # End code ####################################################################### def __successornode(self, node): # Returns the successornode of a node in a BST. If the node is None return None. ####################################################################### # Remove the pass and write your code ####################################################################### pass ####################################################################### # End code ####################################################################### def __replacechild(self, parentnode, currentchild, newchild): # Replaces the currentchild of the parentnode with newchild ####################################################################### # Remove the pass and write your code ####################################################################### pass ####################################################################### # End code ####################################################################### def BSTheight(self): # Prints the height of the BST ####################################################################### # Remove the pass and write your code ####################################################################### pass ####################################################################### # End code ####################################################################### def inorder(self): # Prints the inorder traversal of the BST ####################################################################### # Remove the pass and write your code ####################################################################### pass ####################################################################### # End code #######################################################################
class BST:
def __init__(self, root = None):
if root != None:
root.setparent(None)
self.__root = root
def getroot(self):
# Returns the root node of the tree
#######################################################################
# Remove the pass and write your code
#######################################################################
pass
#######################################################################
# End code
#######################################################################
def setroot(self, node):
# Sets the root node of the tree
#######################################################################
# Remove the pass and write your code
#######################################################################
pass
#######################################################################
# End code
#######################################################################
def insertnode(self, node):
# Inserts a node to the correct position in a BST. A success returns true and failure returns false.
#######################################################################
# Remove the pass and write your code
#######################################################################
pass
#######################################################################
# End code
#######################################################################
def searchnode(self, searchkey):
# Search the BST for a node with searchkey. If found returns the first node with searchkey and failure returns false.
#######################################################################
# Remove the pass and write your code
#######################################################################
pass
#######################################################################
# End code
#######################################################################
def removekey(self, removekey):
node = self.searchnode(removekey)
self.__removenode(node)
def __removenode(self, node):
# Removes a node from the BST. This method uses the __successornode and __replacechild method.
#######################################################################
# Remove the pass and write your code
#######################################################################
pass
#######################################################################
# End code
#######################################################################
def __successornode(self, node):
# Returns the successornode of a node in a BST. If the node is None return None.
#######################################################################
# Remove the pass and write your code
#######################################################################
pass
#######################################################################
# End code
#######################################################################
def __replacechild(self, parentnode, currentchild, newchild):
# Replaces the currentchild of the parentnode with newchild
#######################################################################
# Remove the pass and write your code
#######################################################################
pass
#######################################################################
# End code
#######################################################################
def BSTheight(self):
# Prints the height of the BST
#######################################################################
# Remove the pass and write your code
#######################################################################
pass
#######################################################################
# End code
#######################################################################
def inorder(self):
# Prints the inorder traversal of the BST
#######################################################################
# Remove the pass and write your code
#######################################################################
pass
#######################################################################
# End code
#######################################################################
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 3 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)