improved del_node func(5)

This commit is contained in:
Shaurya Bisht 2024-10-13 10:03:00 +00:00
parent 64822ac0d3
commit ab084df119

View File

@ -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))