C# Interval tree class

核能气质少年 提交于 2019-11-29 05:20:37

There is a download on the codeplex page: http://intervaltree.codeplex.com/SourceControl/list/changesets -> Right hand side -> Download

I just wrote another implementation which can be found here: https://github.com/mbuchetics/RangeTree

It also comes with an asynchronous version which rebuilds the tree using the Task Parallel Library (TPL).

For future visitors, I've written an implementation as well https://github.com/vvondra/Interval-Tree

you can find another c# implementation for an interval tree (based on a self balancing avl tree) @ http://code.google.com/p/intervaltree/

Yet another implementation can be found at https://github.com/erdomke/RangeTree. Unlike other implementations, it aims to have an interface that is similar to IDictionary<TKey, TValue> where possible. It can be used as follows:

var tree = new RangeTree<int, string>()
{
    { 0, 10, "1" },
    { 20, 30, "2" },
    { 15, 17, "3" },
    { 25, 35, "4" },
};

// Alternatively, use the Add method, for example:
// tree.Add(0, 10, "1");

var results1 = tree[5]; // 1 item: [0 - 10] "1"
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!