Skip to content

Commit 78f0d9d

Browse files
author
Akash Mandal
committed
Fixes: TheAlgorithms#8715 Fix for removing the root node in BST removes the whole tree.
1 parent 7310514 commit 78f0d9d

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)