Determing whether two ranges overlap
Robin Haswell
rob at digital-crocus.com
Thu Feb 16 10:22:15 EST 2006
Hey guys
I was wondering if you could give me a hand with something. If I have two
tuples that define a range, eg: (10, 20), (15, 30), I need to determine
whether the ranges overlap each other. The algo needs to catch:
(10, 20) (15, 25)
(15, 25) (10, 20)
(10, 25) (15, 20)
and
(15, 20) (10, 25)
I can think of lots of ways to do this but it's in a tight loop so I need
it to be as efficient as possible. Any help welcome :-)
Cheers
-Rob
More information about the Python-list
mailing list