Question: PYTHON!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Question 1 (2 Sections) 20 points 20 mins 1 Below you are given the implementation of a class named bt_node , which represents a
PYTHON!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!








Question 1 (2 Sections) 20 points 20 mins 1 Below you are given the implementation of a class named bt_node , which represents a node in a binary tree data structure. Complete the implementation of the bt_node.has_children() and bt_node.get_children() methods according to the following specifications: node.bt_node.has_children() should return True if the provided binary tree node object, node , has at least one child and False otherwise. node.bt_node.get_children() should return a list of the immediate children of the given node. That is, if the provided node has no children, this method should return an empty list. Clearly, when the given node has both children, this method will return a list of length 2. class bt_node: Defines a node in the binary tree def __init_( self, value, left-None, right=None ): self.value = value self.left = left self.right = right def has_children( self ): Returns True if this node has at least one child # YOUR CODE HERE raise Not ImplementedError() def get_children( self ): Returns a list of child nodes # YOUR CODE HERE raise Not ImplementedError def __e9__( self, other ): return self.value == other.value def __it__(self, other ): To enable sorting return self.value >> TEST 1 PASSED >> TEST 2 PASSED >> TEST 3 PASSED >> TEST 1 PASSED >> TEST 2 PASSED >> TEST PASSED >> TEST PASSED >> TEST PASSED >> TEST PASSED >> TEST PASSED >> TEST PASSED >> TEST PASSED >> TEST 1 PASSED >> TEST 2 PASSED >> TEST 3 PASSED >> TEST 1 PASSED >> TEST 2 PASSED >> TEST PASSED >> TEST PASSED >> TEST PASSED >> TEST PASSED >> TEST PASSED >> TEST PASSED >> TEST PASSED
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
