-
Notifications
You must be signed in to change notification settings - Fork 1
Bst #1
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
base: master
Are you sure you want to change the base?
Conversation
…o bst Merging branch bst.
…o bst sdf building a binary search tree.
| """ | ||
| if self.root is None: | ||
| return 0 | ||
| return self.calc_depth(self.root.right) - self.calc_depth(self.root.left) |
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.
re-re-reverse this, as the specs want a left heavy tree to be positive
|
|
||
| def search(self, val): | ||
| """Return the node containing that value, else None.""" | ||
| vertex = self.root |
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.
vertex...it's different. Most people use current (curr).
| a.insert(7) | ||
| a.insert(4) | ||
| assert a.contains(4) | ||
|
|
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.
I would consider using fixtures to make your test code a little cleaner
Forked initially from Ted's repo, which he and I had worked on for 2 weeks.