Fix removing the root node in binary_search_tree.py removes the whole tree (#8752)

* fix issue #8715

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Frank-1998 2023-06-18 10:30:06 -06:00 committed by GitHub
parent e6f89a6b89
commit b0f871032e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -40,7 +40,7 @@ class BinarySearchTree:
else: else:
node.parent.left = new_children node.parent.left = new_children
else: else:
self.root = None self.root = new_children
def is_right(self, node: Node) -> bool: def is_right(self, node: Node) -> bool:
if node.parent and node.parent.right: if node.parent and node.parent.right: