Repository commit
7310514
Python version (python --version)
Python 3.10.6
Dependencies version (pip freeze)
astroid==2.15.4
...
Expected behavior
https://github.com/TheAlgorithms/Python/blob/master/data_structures/binary_tree/binary_search_tree.py
Removing the root node should not delete the whole tree, it should behave just like removing any other nodes. It works fine if we delete other nodes but I guess because of the this line, it has problem when we remove the root node. There should be other checks as well.
Actual behavior
>>>t=BinarySearchTree()
>>>t.insert(1)
>>>t.insert(2)
>>>t.insert(3)
>>>t.remove(1)
>>>str(t)
'None'>>>
Repository commit
7310514
Python version (python --version)
Python 3.10.6
Dependencies version (pip freeze)
astroid==2.15.4
...
Expected behavior
https://github.com/TheAlgorithms/Python/blob/master/data_structures/binary_tree/binary_search_tree.py
Removing the root node should not delete the whole tree, it should behave just like removing any other nodes. It works fine if we delete other nodes but I guess because of the this line, it has problem when we remove the root node. There should be other checks as well.
Actual behavior