merging intervals repeatedly

castironpi at gmail.com castironpi at gmail.com
Wed Mar 12 02:16:36 EDT 2008


> > Correct. I meant the final should be
> > (1,30), (29,40), (50,100)
>
>         Actually, even that is incorrect -- note that ,30 overlaps 29,

Actually, given the specification, (overlaps > N count), (1,15), (20,
30), (29, 40), (50, 66), (62,100) is right, since 66-62= 4<= 5. [1]

>         Since this feels like a homework assignment, I won't be posting my
> code...

What are the pros and cons, Mr. Bieber?  Is cl.py a nanny or a
resource?  If someone asks for help, there's probably a reason, and if
they cheat, then they don't learn Python.  Besides, two or three in a
row and that's justified.  Besides, business programmers get plenty of
answers here-- that's cheating too.  Besides, just 'cause you help
somebody else, doesn't mean everyone will.  Besides, your solution
doesn't work for floats.

[1] > My ultimate goal is to produce a final set of intervals such
that not
> two intervals overlap by more than N, where N is a predetermined
> length.



More information about the Python-list mailing list