Greedy Algorithms8 sections · 316 units
Open in Course

When Stays Ahead Works Best

Problem characteristics

Stays ahead works well when:

1.1. There is a natural measure of progress (end time, count, position..)

2.2. Greedy's progress is easy to compare with any alternative's progress

3.3. Being ahead at step kk helps you stay ahead at step k+1k+1

4.4. The inductive step is simple For activity selection, end time is a perfect measure. Finishing earlier gives more room for future activities. The induction flows naturally. If the comparison between greedy and others is direct, stays ahead is your tool.