-
Notifications
You must be signed in to change notification settings - Fork 3
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
Support moving nodes and refactor to eliminate recursion #14
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 good. I would reduce blank lines in the implementation to maintain style consistency.
Please tag a new major release afterward. |
…`traversePostOrder`.
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 want to simplify the
remove
methods (both overloads) such that they don't accept the root pointer reference anymore, because this is already available in the node itself. I think this should be a trivial change. NB:search
cannot be simplified in this fashion because it doesn't take an explicit node as a parameter and it may be invoked on an empty tree. -
Consider adding root pointer invariant checks when the tree is mutated. We know that for any valid node, the root pointer pointer is never null.
-
There is a minor style nit I left an in-place comment about.
Please merge and release v3 afterward. This is a very useful change because it will also allow us to save memory in another project.
But wait, there's more! We can't trivially move the tree class anymore: Line 749 in 7b054aa
We must traverse the entire tree updating the root pointer pointer in every node. That should be easy, can you please add it? |
Yes, you are right - I've missed this :( |
postOrderTraverse
methodconst
vsnon-const
traversal algorythms - now singletraverseXxxOrderImpl
covers these 2 almost identical cases.traverse
→traverseInOrder
; added newtraversePostOrder
.