0

You have $n$ events on your calendar, defined as intervals with a start time $s_i$ and a finish time $f_i$. The events might overlap, and you want to attend all the events, so you are going to create $k$ clones of yourself to achieve this. You want to minimize the number of clones you need, $k$. A clone can attend a certain non-overlapping subset of events.

Source: https://ocw.mit.edu/courses/6-046j-design-and-analysis-of-algorithms-spring-2015/151160c7c18d3f87159b7482823ff61c_MIT6_046JS15_Recitation6.pdf

I am trying to solve the problem above. The solution in the pdf, sorts the starting times. However, I think and have proved (by showing that an optimal solution can go through a series of swaps so that it becomes the result of the wanted algorithm) that it can be done by sorting the ending times. Basically, the algorithm is:

  1. Sort the ending times.
  2. Pop the interval with the smallest ending time. If it can't be visited by any of the existing clones, then make a new clone. Otherwise, choose the clone with the largest ending time such that the interval can still be taken by that clone.

I am pretty convinced that this works, however, I am not able to find any reference on the internet about this algorithm.

Sorting by $f_i$ is optimal in another problem of finding the maximum number of events one can take but not optimal by $s_i$ so it is intuitive to extend the reasoning to this problem. Is this conceptual approach correct?

Lipid
  • 9
  • 2

0 Answers0