mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-04-05 21:35:54 +00:00
improved del_node func(5)
This commit is contained in:
parent
64822ac0d3
commit
ab084df119
@ -208,7 +208,7 @@ def get_min_value_node(node: MyNode) -> MyNode:
|
||||
return current
|
||||
|
||||
|
||||
def del_node(root: Optional[MyNode], data: Any) -> Optional[MyNode]:
|
||||
def del_node(root: MyNode | None, data: Any) -> MyNode | None:
|
||||
if root is None:
|
||||
print("Nothing to delete")
|
||||
return None
|
||||
@ -358,4 +358,4 @@ if __name__ == "__main__":
|
||||
random.shuffle(lst)
|
||||
for i in lst:
|
||||
t.del_node(i)
|
||||
print(str(t))
|
||||
print(str(t))
|
Loading…
x
Reference in New Issue
Block a user