From 99caed4f61576f75bea5c824b89caf14997f7082 Mon Sep 17 00:00:00 2001 From: Haidong Ji Date: Wed, 12 Jun 2019 20:10:34 -0500 Subject: Binary Search Tree check harder version done! 2 simple changes were all needed :) --- sources/tree_bst_check.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sources') 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) -- cgit v1.2.3