Overlap algorithm for dates and segments

Many times when we are programming , we repeat the same calculations several times, and not in the most efficient way. This is an example, the calculation of the overlaping between dates, times or segments.

I think that this schema illustrates really well the trick, and the most efficient (reasoned) solution:

overlap_algorithm

Leave a Reply

Your email address will not be published. Required fields are marked *