dibs: implement binary-search-tree by laurauzcategui · Pull Request #388 · exercism/python
Also @behrtam ,
I think as I rebased the upstream, I brought your changes from there to my branch. I hope this is not a problem. Just wanted to update my branch with latest changes from the upstream
|
|
||
| class BST(object): | ||
| def __init__(self, root): | ||
| self.root = Node(root) |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Requiring an initial value for the BST seems like a very odd design choice...
| def __init__(self, root): | ||
| self.root = Node(root) | ||
|
|
||
| def insert(self, new_val): |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You already wrote this function below. self.pre_insert(self.root, new_val)
| else: | ||
| self.pre_insert(node.left, val) | ||
|
|
||
| def search(self, find_val): |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This search function is probably a little easier to read if you do something like this:
cur = self.root
while cur:
if find_val == cur.value:
return True
cur = cur.left if find_val < cur.value else cur.right
return False
This issue has been automatically marked as `on hiatus because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
@laurauzcategui Would you have a chance to finish this one up? We'd love to include it on the site.
Hi @kytrinyx yes, sure thing. I'll be able to take a look probably next week and over the weekend.
Cheers,
This issue has been automatically marked as on hiatus because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
@kytrinyx Looks like issue was automatically closed, but I have a BST implementation ready in python2 I would like to include this exercise. Can you assign this issue to me and add hacktoberfest label too?
@kabiir that's great. Please submit your pull request. It doesn't need to have an open issue or a hacktoberfest label in order to be counted towards your Hacktoberfest metrics.
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