diff --git a/data_structures/9_Binary_Tree_2/Exercise/binary_tree_part_2_exercise.py b/data_structures/9_Binary_Tree_2/Exercise/binary_tree_part_2_exercise.py index 6b2237c..c745870 100644 --- a/data_structures/9_Binary_Tree_2/Exercise/binary_tree_part_2_exercise.py +++ b/data_structures/9_Binary_Tree_2/Exercise/binary_tree_part_2_exercise.py @@ -61,7 +61,8 @@ def delete(self, val): elif self.left is None: return self.right elif self.right is None: - return self.right + # return self.right + return self.left # because we don't want to loose the left subtree, suppose [2, 4, 3] where 2 is root and we removed 4 max_val = self.left.find_max() self.data = max_val pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy