Content-Length: 795 | pFad | http://github.com/codebasics/data-structures-algorithms-python/pull/64.diff

thub.com 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








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/codebasics/data-structures-algorithms-python/pull/64.diff

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy