Let's say I have a list of ranges like this:
List A) 0 to 3, 9 to 14
List B) 1 to 4, 6 to 7, 14 to 16
List C) 15 (i.e., 15 to 15)
I'd like to get a merged list of these ranges where the result would look like this:
Merged Result List) 0 to 4, 6 to 7, 9 to 16
(notice that the result is a merging/intersection/union of Lists A, B, and C)
I'm sure there's an algorithm for this, but have no idea. Has anyone come across this before?
(pseudocode, or VB, would be great)
Adding a visual representation: