-
-
Notifications
You must be signed in to change notification settings - Fork 450
feat(data-struct): binary search tree #106
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
Conversation
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.
Looks correct overall. However:
- You should not expose implementation details like the
TreeNode<T>
. From the outside, yourBinarySearchTree<T>
should behave just like aSortedSet<T>
implementation. - Your traversals should not take a
TreeNode<T>
; instead, they should all start at the root node. It'd be reasonable to implement them using either a closure (as you did withfindMin
/findMax
) or methods of theTreeNode<T>
helper class.
I resolved most of the things you mentioned directly in the code. However, I am a bit confused with the first point you mentioned as a comment. 😅
Am I right with the assumption that this point was related to the |
It was related to the traversals as well. You have addressed it properly. |
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.
Tests are failing.
This is an implementation of a binary search tree. If there are any inconveniences, please comment here, so I can improve the code.