Browse Source

Added lookup to BST

master
Raphael Roberts 6 years ago
parent
commit
dd97ffb201
  1. 9
      BST.py

9
BST.py

@ -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)

Loading…
Cancel
Save