Skip to content

Commit a22aa85

Browse files
Update datastructures/trees/binary/search_tree/binary_search_tree.py
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent 0bc5654 commit a22aa85

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

datastructures/trees/binary/search_tree/binary_search_tree.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ def find_closest_value_in_bst(self, target: T) -> Optional[BinaryTreeNode]:
347347

348348
# while the queue is not empty, we pop off nodes from the queue and check for their values
349349
while current:
350-
current_diff = abs(target - self.root.data)
350+
current_diff = abs(target - current.data)
351351

352352
if current_diff < min_diff:
353353
min_diff = current_diff

0 commit comments

Comments
 (0)