mirror of
https://hub.njuu.cf/TheAlgorithms/Python.git
synced 2023-10-11 13:06:12 +08:00
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:
parent
e6f89a6b89
commit
b0f871032e
@ -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:
|
||||||
|
Loading…
Reference in New Issue
Block a user