mirror of
https://github.com/autistic-symposium/master-algorithms-py.git
synced 2025-06-24 14:50:48 -04:00
Update bst.py
This commit is contained in:
parent
a2dce9493e
commit
51e6497cef
1 changed files with 3 additions and 3 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue