-
Notifications
You must be signed in to change notification settings - Fork 332
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
binary_search_tree.py: Add BST data structure #122
Conversation
@sangamcse Please review. |
@sangamcse rebase |
Hey! I'm GitMate.io! This pull request is being rebased automatically. Please DO NOT push while rebase is in progress or your changes would be lost permanently |
Automated rebase with GitMate.io was successful! 🎉 |
Update in Readme and code comments needed. |
""" | ||
Class that represent a leaf node of a binary tree. | ||
""" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line contains following spacing inconsistencies:
- Trailing whitespaces.
Origin: SpaceConsistencyBear, Section: python spacing
.
The issue can be fixed by applying the following patch:
--- a/tmp/tmpikx6la4g/binary_search_tree/Python/binary_search_tree.py
+++ b/tmp/tmpikx6la4g/binary_search_tree/Python/binary_search_tree.py
@@ -2,7 +2,7 @@
"""
Class that represent a leaf node of a binary tree.
"""
-
+
def __init__(self, value=None, leftChild=None, rightChild=None):
self.value = value
self.leftChild = leftChild
Class that represents a Binary Search Tree | ||
<https://en.wikipedia.org/wiki/Binary_search_tree>. | ||
""" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line contains following spacing inconsistencies:
- Trailing whitespaces.
Origin: SpaceConsistencyBear, Section: python spacing
.
The issue can be fixed by applying the following patch:
--- a/tmp/tmpikx6la4g/binary_search_tree/Python/binary_search_tree.py
+++ b/tmp/tmpikx6la4g/binary_search_tree/Python/binary_search_tree.py
@@ -27,7 +27,7 @@
Class that represents a Binary Search Tree
<https://en.wikipedia.org/wiki/Binary_search_tree>.
"""
-
+
def __init__(self):
self.root = None
|
||
def __init__(self): | ||
self.root = None | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line contains following spacing inconsistencies:
- Trailing whitespaces.
Origin: SpaceConsistencyBear, Section: python spacing
.
The issue can be fixed by applying the following patch:
--- a/tmp/tmpikx6la4g/binary_search_tree/Python/binary_search_tree.py
+++ b/tmp/tmpikx6la4g/binary_search_tree/Python/binary_search_tree.py
@@ -30,7 +30,7 @@
def __init__(self):
self.root = None
-
+
def __del__(self):
del self.root
else: | ||
currentNode.value = value | ||
return currentNode | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line contains following spacing inconsistencies:
- Trailing whitespaces.
Origin: SpaceConsistencyBear, Section: python spacing
.
The issue can be fixed by applying the following patch:
--- a/tmp/tmpikx6la4g/binary_search_tree/Python/binary_search_tree.py
+++ b/tmp/tmpikx6la4g/binary_search_tree/Python/binary_search_tree.py
@@ -60,7 +60,7 @@
else:
currentNode.value = value
return currentNode
-
+
def main():
values = [1, 2, 0, 1.5, 0.5]
tree = BST()
@sangamcse I've updated the code problems and updated the README file. Please check again once you're ready. |
@sangamcse rebase |
Hey! I'm GitMate.io! This pull request is being rebased automatically. Please DO NOT push while rebase is in progress or your changes would be lost permanently |
@gabrieldluca, I tried rebasing your repo but it failed. Kindly rebase it locally and push it again on success. |
@sangamcse Done! |
@sangamcse rebase |
Hey! I'm GitMate.io! This pull request is being rebased automatically. Please DO NOT push while rebase is in progress or your changes would be lost permanently |
This adds Binary Search Tree data structure which keeps values in sorted order, so that lookup and other operations can use the principles of binary search while traversing the tree from root to leaf. Closes #51
Automated rebase with GitMate.io was successful! 🎉 |
@sangamcse rebase |
Hey! I'm GitMate.io! This pull request is being rebased automatically. Please DO NOT push while rebase is in progress or your changes would be lost permanently |
Automated rebase failed! Please rebase your pull request manually via the command line. Reason:
|
@gabrieldluca the PR is approved but we need to rebase it before merging it. So rebase it manually and remind me on gitter once it is done https://gitter.im/NITSkmOS/algo Note: Do not open any PR to any organization from the master branch because it makes difficult to maintain the PR. |
This adds Binary Search Tree algorithm which keeps values in sorted
order, so that lookup and other operations can use the principles of
binary search while traversing the tree from root to leaf.
Closes #51
By submitting this pull request I confirm I've read and complied with the
below declarations.
{Tag}: Add {Algorithm/DS name} [{Language}]
, notUpdate README.md
orAdded new code
.After you submit your pull request, DO NOT click the 'Update Branch' button.