def insert_at_node(self, data, node): if data < node.get_data(): if node.get_left() == None: temp = node.Node() temp.set_data(data) node.set_left(temp) else: self.insert_at_node(data, node.get_left()) else: if node.get_right() == None: temp = node.Node() temp.set_data(data) node.set_right(temp) else: self.insert_at_node(data, node.get_right())
def insert_at_node(self, data, node): if data < node.get_data(): if node.get_left() == None: temp = node.Node(); temp.set_data(data); node.set_left(temp); else: self.insert_at_node(data, node.get_left()); else: if node.get_right() == None: temp = node.Node(); temp.set_data(data); node.set_right(temp); else: self.insert_at_node(data, node.get_right())