projects
/
pyutils.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6ddfe8b
)
Cleanup code / comments.
author
Scott Gasch
<
[email protected]
>
Sat, 6 May 2023 21:22:32 +0000
(14:22 -0700)
committer
Scott Gasch
<
[email protected]
>
Sat, 6 May 2023 21:22:32 +0000
(14:22 -0700)
src/pyutils/collectionz/bst.py
patch
|
blob
|
history
diff --git
a/src/pyutils/collectionz/bst.py
b/src/pyutils/collectionz/bst.py
index 9538708728af4968dbab9cdf79d89a1c27f96af8..343ddc0763c39d93c3db7737c935e205e58edf99 100644
(file)
--- 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
):