You are viewing a single comment's thread. Return to all comments →
Python solution:
def insert(r,val): if r is None: r = Node('') r.data = val elif val < r.data: if r.left is None: r.left = Node('') r.left.data = val else: insert(r.left, val) else: if r.right is None: r.right = Node('') r.right.data = val else: insert(r.right, val) return r
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 solution: