mirror of
https://github.com/autistic-symposium/master-algorithms-py.git
synced 2025-04-29 20:26:07 -04:00
Update bst.py
This commit is contained in:
parent
a2dce9493e
commit
51e6497cef
@ -25,11 +25,11 @@ class Node(object):
|
|||||||
def search(self, item):
|
def search(self, item):
|
||||||
if self.value == item:
|
if self.value == item:
|
||||||
return True
|
return True
|
||||||
found = False
|
|
||||||
if (self.left and self.left.search(item)) or \
|
if (self.left and self.left.search(item)) or \
|
||||||
(self.right and self.right.search(item)):
|
(self.right and self.right.search(item)):
|
||||||
found = True
|
return True
|
||||||
return found
|
return False
|
||||||
|
|
||||||
def preorder(self):
|
def preorder(self):
|
||||||
yield self.value
|
yield self.value
|
||||||
|
Loading…
x
Reference in New Issue
Block a user