0

Is there any library out there for C, C++, or .NET that implements a "sparse map"? (I don't know a better name for it.)

I'm looking for something like run-length encoding, like for allocating files on a disk. The data structure should be able to hold information saying "Clusters 0 to 1000 have been allocated by file 1, clusters 1000 to 9025234 have been allocated by file 2", etc. It needs to be indexable by the cluster number.

(It should obviously support around log(n) or better insertion + removal time, otherwise it'd be too slow.)

user541686
  • 189,354
  • 112
  • 476
  • 821
  • 1
    Possible duplicate of [Help finding C++ interval tree algorithm implementation](http://stackoverflow.com/questions/212808/help-finding-c-interval-tree-algorithm-implementation). Now that I know the name "interval tree", I also found that my question is a duplicate... – user541686 May 16 '11 at 05:41

1 Answers1

1

"sparse map"? You likely mean interval tree.

CGAL contains a robust implementation in C++.

Will
  • 68,898
  • 35
  • 156
  • 231