mirror of
https://github.com/autistic-symposium/master-algorithms-py.git
synced 2025-05-03 07:15:04 -04:00
Update bst_is_valid.py
This commit is contained in:
parent
5108f546c6
commit
faa7b70a00
1 changed files with 2 additions and 4 deletions
|
@ -14,10 +14,8 @@ def is_valid_bst_iterative(root):
|
|||
if node:
|
||||
if min_val >= node.val or node.val >= max_val:
|
||||
return False
|
||||
if node.left:
|
||||
queue.append((node.left, min_val, node.val))
|
||||
if node.right:
|
||||
queue.append((node.right, node.val, max_val))
|
||||
queue.append((node.left, min_val, node.val))
|
||||
queue.append((node.right, node.val, max_val))
|
||||
|
||||
return True
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue