def bstAddValue(val, head): cur = head while cur != "NULL": par = cur if val == cur.value: return head elif val > cur.value: cur = cur.childr pos = "r" else: cur = cur.childl pos = "l" if pos == "r": par.childr = ADT.bstNode(val, "NULL", "NULL") else: par.childl = ADT.bstNode(val, "NULL", "NULL") return head
def bstNewNode(val): new = ADT.bstNode(val, "NULL", "NULL") return new