imrpoved del_node func(4)

This commit is contained in:
Shaurya Bisht 2024-10-13 09:54:44 +00:00
parent f4c580027b
commit c7c6efed9a

View File

@ -10,7 +10,7 @@ from __future__ import annotations
import math
import random
from typing import Any
from typing import Any, Optional
class MyQueue:
@ -208,7 +208,7 @@ def get_min_value_node(node: MyNode) -> MyNode:
return current
def del_node(root: MyNode, data: Any) -> MyNode | None:
def del_node(root: Optional[MyNode], data: Any) -> Optional[MyNode]:
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))