Finish these functions in the code: def get_height (self): # Add…

Question Finish these functions in the code: def get_height (self): # Add… Image transcription textLeft Sum of BST Imagine you are looking at the left side of a binary search tree. The left-side-view nodes arenodes that are of the left-most node at each level. Return the sum of all the left-side-view nodes. Exampleinput: 15 10 20 9 30 Output: 34 Explanation: Input: A sequence of integers representing the BST … Show more… Show moreFinish these functions in the code:  def get_height (self):# Add your code here! def get_level (self, level):# Add your code here! # Returns an integer for the left sum of the BST def get_left_sum(self):# Add your code here!  Code:import sysclass Queue(object):   def __init__(self):       self.queue = []   # add an item to the end of the queue   def enqueue(self, item):       self.queue.append(item)   # remove an item from the beginning of the queue   def dequeue(self):       return (self.queue.pop(0))   # check if the queue is empty   def is_empty(self):       return (len(self.queue) == 0)   # return the size of the queue   def size(self):       return (len(self.queue))class Node (object): def __init__ (self, data):   self.data = data   self.lchild = None   self.rchild = Noneclass Tree (object): def __init__ (self):   self.root = None # insert data into the tree def insert (self, data):   new_node = Node (data)   if (self.root == None):     self.root = new_node     return   else:     current = self.root     parent = self.root     while (current != None):       parent = current       if (data < current.data):         current = current.lchild       else:         current = current.rchild     # found location now insert node     if (data < parent.data):       parent.lchild = new_node     else:       parent.rchild = new_node # ***There is no reason to change anything above this line*** def get_height (self):# Add your code here! def get_level (self, level):# Add your code here! # Returns an integer for the left sum of the BST def get_left_sum(self):# Add your code here!# ***There is no reason to change anything below this line***def main():   # Create tree   line = sys.stdin.readline()   line = line.strip()   line = line.split()   tree_input = list (map (int, line))    # converts elements into ints   tree = Tree()   for i in tree_input:     tree.insert(i)   print(tree.get_left_sum())if __name__ == "__main__": main() Computer Science Engineering & Technology Python Programming CSCI 1310 Share QuestionEmailCopy link Comments (0)