Java implementation of intervaltree deletenode

I need an intervaltree or rangetree implementation in Java and can't find an implementation with work deletion support

In sun jvm. hotspot. utilities. Intervaltree has a built-in, but the deletenode method in the rbtree superclass indicates:

/**
 * FIXME: this does not work properly yet for augmented red-black
 * trees since it doesn't update nodes. Need to figure out exactly
 * from which points we need to propagate updates upwards.
 */

An attempt to delete a node from the tree will eventually throw an exception:

In sun jvm. hotspot. utilities. How difficult is it to properly implement the deletion function in subclasses of intervaltree? Or is there another interval tree implementation that has implemented this correctly?

At present, I just erase the tree and refill it every time I delete it, which is far from ideal (Note: setting debugging = false in rbtree will greatly speed up the speed)

Solution

I finally modified sun jvm. hotspot. utilities. Intervaltree to maintain a set of deleted nodes When searching, I exclude all items in this collection Not ideal, but it's much easier than "real" deletion Once the deleted set becomes too large, I rebuild the tree

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>