The scenario is a timeline of events, that I want to be able to query for all items within a specific date range.
I am looking for a data structure in .NET (up to v4.0) that stores items as sorted and unique (for example, by using a comparer or a unique key). It should support adding/deleting at no more than logarithmic complexity, and performing binary search at that complexity as well.
System.Collections.Generic.SortedSet
seemed like what I wanted, but its GetViewBetween()
method returns an inclusive list of items, as a SortedSet.
I am missing two things in it:
- Calling
ToList()
or enumerating the SortedSet is too expensive, as the list is long. I need the method return aList<T>
, not aSortedSet<T>
. - Calling it with an inclusive/exclusive date range, to my choice - not possible and I need that too.
If you know a good library that contains such a data structure, that is tested and familiar, I would sure like to try it.
Thanks.