We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fb4cb73 commit 4746e3eCopy full SHA for 4746e3e
search/binary_search_tree.py
@@ -26,13 +26,16 @@ def insert(self, value):
26
def contains(self, target):
27
if self.value == target:
28
return True
29
- if self.left:
30
- if self.left.contains(target):
31
- return True
32
- if self.right:
33
- if self.right.contains(target):
34
35
- return False
+ if target < self.value:
+ if not self.left:
+ return False
+ else:
+ return self.left.contains(target)
+ if not self.right:
36
37
38
+ return self.right.contains(target)
39
40
def get_max(self):
41
if not self:
0 commit comments