Algorithm for flattening overlapping ranges
Posted
by
Joseph
on Programmers
See other posts from Programmers
or by Joseph
Published on 2014-05-29T02:25:15Z
Indexed on
2014/05/29
15:54 UTC
Read the original article
Hit count: 251
I am looking for a nice way of flattening (splitting) a list of potentially-overlapping numeric ranges. The problem is very similar to that of this question: Fastest way to split overlapping date ranges, and many others.
However, the ranges are not only integers, and I am looking for a decent algorithm that can be easily implemented in Javascript or Python, etc.
Example Data:
Example Solution:
Apologies if this is a duplicate, but I am yet to find a solution.
© Programmers or respective owner