-
Notifications
You must be signed in to change notification settings - Fork 9.8k
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
pkg/adt violates red-black tree black-height property #10965
Comments
Basically we need fix etcd/pkg/adt/interval_tree_test.go Lines 255 to 303 in 3b631e1
|
https://github.com/etcd-io/etcd/blob/master/pkg/adt/interval_tree.go#L298 delete node 514 and 11, will not exec the deleteFixUp function, because the node x is nil I can pass all test cases with my codes. |
@xkeyideal I tried your patch. |
@gyuho Please see the code https://github.com/xkeyideal/etcd/blob/master/pkg/adt/interval_tree.go I change it based on your test cases, it can pass |
@xkeyideal Could you create a new PR? Thanks. |
Fixed via 003362e. Thanks @xkeyideal |
Introduction to Algorithms by Charles E. Leiserson, Clifford Stein, Ronald Rivest, and Thomas H. Cormen:
Current delete operation violates "black-height" property.
For example, given this red-black tree:
Let's delete the node
11
.The tree should be rebalanced as below:
However, current implementation returns:
This violates "black-height" property.
ref. #10877.
The text was updated successfully, but these errors were encountered: