summaryrefslogtreecommitdiff
path: root/sources
diff options
context:
space:
mode:
authorHaidong Ji2019-06-12 20:10:34 -0500
committerHaidong Ji2019-06-12 20:10:34 -0500
commit99caed4f61576f75bea5c824b89caf14997f7082 (patch)
treeb302e1418a70acb5660bf8177dd694d1aca63db9 /sources
parentced86db4658bdc3aba7e3f59991c1723ceae0531 (diff)
Binary Search Tree check harder version done!HEADmaster
2 simple changes were all needed :)
Diffstat (limited to 'sources')
-rw-r--r--sources/tree_bst_check.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/sources/tree_bst_check.py b/sources/tree_bst_check.py
index 28af017..b646d4c 100644
--- a/sources/tree_bst_check.py
+++ b/sources/tree_bst_check.py
@@ -21,13 +21,13 @@ def isBst(key, left, right):
else:
i = keyIndexStack.pop()
if len(result) > 0:
- if key[i] <= result[-1]:
+ if key[i] < result[-1]:
return False
result.append(key[i])
walkLeft = False
else:
if right[currentIndex] != -1:
- if key[right[currentIndex]] <= key[currentIndex]:
+ if key[right[currentIndex]] < key[currentIndex]:
return False
currentIndex = right[currentIndex]
keyIndexStack.append(currentIndex)