Greedy Algorithms8 sections · 316 units
Open in Course

Minimum Cover - Algorithm

Greedy extension

Sort by start time. Greedily extend coverage as far as possible.

1.1. Sort intervals by start.

2.2. Track current coverage end.

3.3. Among intervals starting at or before current end, pick the one extending furthest.

4.4. Update coverage end and increment count.

5.5. Repeat until coverage >= T or no progress possible. Time: O(nlogn)O(n \log n). Space: O(1)O(1). Common bug: picking the first usable interval instead of the one that extends furthest.