We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fb53ab8 commit 240acd1Copy full SHA for 240acd1
data_structures/binary_tree/avl_tree.py
@@ -220,12 +220,11 @@ def del_node(root: MyNode, data: Any) -> MyNode | None:
220
return root
221
else:
222
root.set_left(del_node(left_child, data))
223
+ elif right_child is None:
224
+ print(f"No such data ({data}) exists in the right subtree.")
225
+ return root
226
- if right_child is None:
- print(f"No such data ({data}) exists in the right subtree.")
- return root
227
- else:
228
- root.set_right(del_node(right_child, data))
+ root.set_right(del_node(right_child, data))
229
230
# Update the height of the node
231
root.set_height(
0 commit comments