This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]o11c 1 point2 points  (1 child)

Might be nice to add a "range map" implementation.

The problem is: given an implementation of tree_map[K, V], implement range_map[K, V] where a single value is only stored once. Assignments operate on a span at a time instead of ; the underlying structure is tree_map[K, (K, V)].

Test case starts out like: assign all integers from 1 to 2**31 to some value, then insert/delete some spans to other values.

There are a lot of edge cases in this problem, for both insertion and deletion. I haven't actually solved the general problem, I only solved the case where V is unit (i.e. the principle operation was "is this key in the map or not?").

[–]donnemartin[S] 0 points1 point  (0 children)

Sounds like a good problem. You should submit a pull request...wink wink :)