-
Notifications
You must be signed in to change notification settings - Fork 114
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
top down 2-3-4 mode does not correctly delete #7
Comments
Sorry I've taken awhile. I am currently too busy to look into this. Mainly because Otherwise, I should say that the 2-3 version has been in P On 3 July 2012 17:58, kortschak
|
I have a fix implemented in biogo.llrb that is a relatively minor change. It may well not be worth the effort though - inserts and deletes are worse, though retrieval is very slightly faster (benchmark comparisons are available in the commit message). Can I suggest that if you don't implement the fix, code referring to TD2-3-4 be removed or marked as unsafe for use with deletion? Also, I have found in by own implementation that deletion from non-uniquely inserted tree results in tree invariant contradiction. I haven't found a way around this except to make all insertions unique by adding a unique identifier as a tie-breaker. This bug is noted here. Since your delete code is substantively algorithmically identical to mine, and the effective approach to non-replacing insertion is similar to mine, GoLLRB probably will have the same behaviour in this case. Initially, breaking the tree invariants does not cause a problem, but will eventually result in nil pointer dereference in flipColor or the rotate operations because they assume the invariants hold. You may want to have a look at this since you provide explicit non-replacing insertion. |
I have a failing case for GoLLRB here https://gist.github.com/3505575 |
Hi,
I noticed this because I've been writing an llrb, and on my own project I can't get deletion to test as correct when using top down 2-3-4 insertion (see post on golang-nuts).
I wanted to check my sanity (I've pored over the code so many times to see if I'm doing something stupid), so I inserted one of my failing deletion tests into GoLLRB and it gives equivalent behaviour (passes on bottom up 2-3 and fails catastrophically on top down 2-3-4).
The test is obviously very vicious, but is fine with the standard 2-3 GoLLRB insertion mode.
Any ideas?
The text was updated successfully, but these errors were encountered: