in reply to overlap between ranges
I would assume that the usual definition of overlap applies - that two sets overlap if they contain at least one common element.
You haven't described what you've tried so far, so I'm going to only outline some potential approaches. As this is not a program writing site, but a site for discussion and help with specific programming problems, you won't get a complete program from me.
The naive approach:
The direct approach
Note that two ranges overlap if
There are other possibilities, like sorting your ranges by lower boundary and then checking for overlap - if you do it that way, you will need to add some more criteria for completely contained subranges.
|
|---|