Skip to content

Repair the drop code in RedBlackTreeNode #56

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

Open
ckaran opened this issue Feb 8, 2021 · 0 comments
Open

Repair the drop code in RedBlackTreeNode #56

ckaran opened this issue Feb 8, 2021 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@ckaran
Copy link
Collaborator

ckaran commented Feb 8, 2021

Actually, now that I'm looking at this code, I can see that it's quite, quite broken. The reason for the guards was because fixup_neighbor() was called on all of self's neighbors, and that fixup_neighbor() had to figure out which neighbor was being fixed up. That is really a poor way of doing it as each if statement already knows which neighbor its working on, so fixup_neighbor() is unnecessary.

That said, this does give a good opportunity to put in some debug asserts; our children should see us as their parent, and our parent should see us as their child. If these invariants are ever broken, then so is the tree.

Originally posted by @ckaran in #54 (comment)

@ckaran ckaran self-assigned this Feb 8, 2021
@ckaran ckaran added the bug Something isn't working label Feb 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant