Encoding/decoding ranges of unsigned integers...



Here is the description of a problem:

Assume you have n integer ranges: [i, j], [k, l], [m, n]...

There is no particular order on the sequence of ranges.
There is no gap in any of the ranges.

Is there a smart way to encode these ranges into a representation that would be both compact and efficient to encode/decode.

Before I go about and re-invent the wheel, I would like to know if there is a well known algorithm to accomplish this.
.




Relevant Pages