FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

corrected a simple mistake in deletion by ideepankarsharma2003 · Pull Request #64 · codebasics/data-structures-algorithms-python · GitHub

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

Back | FazBrowse Home | New Git URL