Setting
- We are given a set of requests
- has a start time given by and a finish time given by
- There is a machine which can handle one request at a time
- Two requests “conflict” if they overlap.

The Interval Scheduling Problem
Select a set of requests such that is maximised and no two requests from conflicts.
Failed Attempt 1
Always select the request which starts the earliest, i.e., one having minimum starting time.
Failed Attempt 2
Always select the request which needs minimum time to be handled, i.e., the request which minimises
Failed Attempt 3
Always select the request which has fewest conflicting requests.
The correct greedy algorithm
- Observation: does not contain any conflicting requests (from line 7)
- Suppose there is another algorithm ANY which selects strictly more requests that our greedy algorithm
- Let GREEDY selects in that order
- Let ANY schedule in that order for some
- Lemma: For each , we have
- Proof by induction on . Base case is
- Inductive step:
- So, does not conflict with
- But our algorithm choose instead of , i.e.,
- Since , selects a request
- Contradiction to our algorithm stopping after selecting