You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, there is a problem in the implementation of the delete function of Red Black Tree. rbtree.go:219:
ify!=z {
z.key=y.keyz.value=y.value
}
It reuse the node-to-delete z in the tree and delete the successor node y
This is not correct because all pointers stored by the user on the y node will be invalidated.
I found a solution in the C++ STL of clang 13 (I believe), they swap the nodes y and z such that only z is invalidated, as expected.
Here is the code that I found: __tree:382:
But unfortunately this solution seems to break the tree for some reason that I don't know, it fail the tests.
Could a brilliant brain figure it out? I'm stuck
The text was updated successfully, but these errors were encountered:
Hi, there is a problem in the implementation of the delete function of Red Black Tree.
rbtree.go:219
:It reuse the node-to-delete
z
in the tree and delete the successor nodey
This is not correct because all pointers stored by the user on the
y
node will be invalidated.I found a solution in the C++ STL of clang 13 (I believe), they swap the nodes
y
andz
such that onlyz
is invalidated, as expected.Here is the code that I found:
__tree:382
:Which I try'd to adapt to our implementation, it give me something like:
rbtree.go:219
:But unfortunately this solution seems to break the tree for some reason that I don't know, it fail the tests.
Could a brilliant brain figure it out? I'm stuck
The text was updated successfully, but these errors were encountered: