|
|
|
@ -55,6 +55,15 @@ class BST: |
|
|
|
parent.left = to_add |
|
|
|
self.size += 1 |
|
|
|
|
|
|
|
def lookup(self, value): |
|
|
|
current = self.root |
|
|
|
while current.value != value and current is not None: |
|
|
|
if value < current.value: |
|
|
|
current = current.left |
|
|
|
elif value > current.value: |
|
|
|
current = current.right |
|
|
|
return current |
|
|
|
|
|
|
|
def in_order(self): |
|
|
|
ret = [] |
|
|
|
in_order_rec(self.root, ret) |
|
|
|
|