From: Scott Gasch Date: Sat, 6 May 2023 21:22:32 +0000 (-0700) Subject: Cleanup code / comments. X-Git-Url: https://wannabe.guru.org/gitweb/?a=commitdiff_plain;h=2340db546329295f9b68ab2bc5b9ea3148707422;p=pyutils.git Cleanup code / comments. --- diff --git a/src/pyutils/collectionz/bst.py b/src/pyutils/collectionz/bst.py index 9538708..343ddc0 100644 --- a/src/pyutils/collectionz/bst.py +++ b/src/pyutils/collectionz/bst.py @@ -180,10 +180,13 @@ class BinarySearchTree(object): if target == node.value: return node - elif target >= node.value: + + elif target > node.value: return self._find_lowest_value_greater_than_or_equal_to(target, node.right) + + # If target < this node's value, either this node is the + # answer or the answer is in this node's left subtree. else: - assert target < node.value if below := self._find_lowest_value_greater_than_or_equal_to( target, node.left ):