Question: Use the following code to represent a node of a Binary Tree: Class Node: def __init__(self, value): self.value = value self.left = None self.right =
Use the following code to represent a node of a Binary Tree:
Class Node:
def __init__(self, value):
self.value = value
self.left = None
self.right = None
1. Create a class BST and write the following functions:
a. Write a function AddElement that adds elements in Binary search tree.
class BST:
def __init__(self):
self.root = None
def AddElement(self, value):
// your code goes here
b. Write a function GetUnique that returns the node values which are unique in the BST.
def GetUnique(self):
// your code goes here
c. Write a function DeleteDuplicates that deletes the duplicate nodes from a BST.
def DeleteDuplicates(self):
// your code goes here
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
