Question 2 MCQ · 3.0 marks
We are given as input a set of n requests (e.g., for the use of a classroom), with a known **start**
**time**
and **finish time**
for each request
.
Assume that all start and finish times are **distinct**.
Two requests are said to conflict if their intervals overlap, i.e., if
and
.
Our goal is to select a **maximum-cardinality subset** of the given requests that contains **no**
**conflicts**.
**Example:**
Given three requests consuming the intervals
,
, and
, the optimal solution selects
the **first and third** requests.
We aim to design a greedy algorithm of the following form:
At each iteration, we select a new request
, include it in the solution-so-far, and delete from future
consideration all requests that conflict with
.
Which of the following greedy rules is guaranteed to always compute an optimal solution?
At each iteration, pick the remaining request with the **fewest number of**
**conflicts** with other remaining requests (breaking ties arbitrarily).
At each iteration, pick the remaining request with the **earliest start time**.
At each iteration, pick the remaining request with the **earliest finish time**.
At each iteration, pick the remaining request which requires the **least time**
(i.e., has the smallest value of
) (breaking ties arbitrarily).
Published solution
**1. Recall the Interval Scheduling (Activity Selection) theorem:**
To find a maximum-cardinality subset of mutually compatible intervals \( [s(i), f(i)] \), selecting the compatible request that finishes as early as possible (**earliest finish time**, \( \min f(i) \)) leaves the maximum possible remaining time \( [f(i), \infty) \) for future intervals. By a standard exchange argument (staying-ahead lemma), this greedy rule is guaranteed to produce an optimal solution.
**2. Why the other heuristics fail:**
- **Earliest start time (B):** Fails if the earliest-starting interval is very long (e.g., \( [1, 10], [2, 3], [4, 5] \)).
- **Shortest duration (D):** Fails when a short interval overlaps the boundary between two longer compatible intervals (e.g., \( [1, 5], [4, 6], [5, 9] \)).
- **Fewest conflicts (A):** Fails on standard counterexamples where a middle interval conflicts with two intervals that themselves conflict with three others.
**Answer: C — At each iteration, pick the remaining request with the earliest finish time.**
A: **Incorrect:** Picking the interval with the fewest conflicts has a known counterexample of 11 intervals where it chooses a suboptimal set.
B: **Incorrect:** Picking the earliest start time can select one long interval \( [1, 100] \) that blocks many short non-overlapping intervals.
C: **Correct:** Earliest-finish-time first is the provably optimal greedy strategy for interval scheduling.
D: **Incorrect:** Picking the shortest interval \( [4, 6] \) can block two compatible intervals \( [1, 5] \) and \( [5, 9] \).