+ 1
Whats the problem im not getting value 15 even i haven't deleted it... Something missing in delete fun????
2 odpowiedzi
+ 1
yes, you have a problem in the delete function.
in the first 'else' statement, you should test if 'cur_node.left is not none and cur_node.right is none'
your code should look like this:
if cur_node.left is None and cur_node.right is None:
...
elif cur_node.left is not None and cur_node.right is None:
...
elif cur_node.right is not None and cur_node.left is None:
...
else:
#both cur_node.left and cur_node.right are not None.
...
0
John Robotane thnku so much..... Literally got irritated.....
Thnku👍