in a scheduling program, we want to check wether two appointments overlap. For simplicity, appointments start at a full hour, and we use military time (with hours 0-24), the following pseudocode describes an algorithm that determines whether the appointment with start time /start1/ and end time /end1/ overlaps with the appointment with start time /start2/ and end time /end2/
if start1 > start2
s = start1
else
s = start2
if end1 < end2
e = end1
else
e = end2
if s < e
the appointments overlap.
else
the appointments don't overlap
trace this algorithm with an appointment from 10-12 and one from 11-13, then with an appointment from 10-11 and one from 12-13.