Cleanup code / comments.
authorScott Gasch <[email protected]>
Sat, 6 May 2023 21:22:32 +0000 (14:22 -0700)
committerScott Gasch <[email protected]>
Sat, 6 May 2023 21:22:32 +0000 (14:22 -0700)
src/pyutils/collectionz/bst.py

index 9538708728af4968dbab9cdf79d89a1c27f96af8..343ddc0763c39d93c3db7737c935e205e58edf99 100644 (file)
@@ -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
             ):