Skip to content

Commit b0f8710

Browse files
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>
1 parent e6f89a6 commit b0f8710

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

data_structures/binary_tree/binary_search_tree.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def __reassign_nodes(self, node: Node, new_children: Node | None) -> None:
4040
else:
4141
node.parent.left = new_children
4242
else:
43-
self.root = None
43+
self.root = new_children
4444

4545
def is_right(self, node: Node) -> bool:
4646
if node.parent and node.parent.right:

0 commit comments

Comments
 (0)