Skip to content
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

adds removeNode #5

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

adds removeNode #5

wants to merge 7 commits into from

Conversation

shaunc
Copy link

@shaunc shaunc commented Oct 15, 2018

This adds removeNode (which was in doc but not implemented). This allows the replacement of a node with particular data, given a tree with duplicates.

It uses the first remove strategy in the wikipedia article, as splay() only works up to key equality.
It also uses removeNode() to implement remove(): arguably (depending on use case), splaying on removal won't help search performance.

Experimental "findParent" to find the parent of a node also added (though I haven't written tests for it separately -- it is used in removeNode for the case that the removed node is a leaf).

@w8r
Copy link
Owner

w8r commented Oct 17, 2018

Thanks a lot! Let me take a look at the findParent to understand it better, and run the benchmarks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants