You are viewing a single comment's thread. Return to all comments →
Python:
def add_to_node(self, node, val): if val<node.info: if node.left is None: node.left=Node(val) else: self.add_to_node(node.left, val) elif val>node.info: if node.right is None: node.right=Node(val) else: self.add_to_node(node.right, val) def insert(self, val): if self.root is None: self.root=Node(val) else: self.add_to_node(self.root, val)
Seems like cookies are disabled on this browser, please enable them to open this website
Binary Search Tree : Insertion
You are viewing a single comment's thread. Return to all comments →
Python: