Merging overlapping spans/ranges

elbertlev at hotmail.com elbertlev at hotmail.com
Tue May 10 15:45:47 EDT 2005


The linear method:

You create an array - one bool per minute. For one day 24 * 60 entries
is enough. Spans (Start, End) are in minutes from midnight. Set array
slots in range(Start, End) to True for each input span.

Scan the array and find metaspans - contiguous sequences of False.




More information about the Python-list mailing list