Greedy Algorithms8 sections · 316 units
Open in Course

Intro

The gateway problem

Activity selection is the classic greedy problem. It teaches the core pattern you will use in dozens of other problems.

The problem is simple: you have activities with start and end times, and you want to select as many non-overlapping activities as possible.

In this section, I will walk you through the problem, show you why sorting by end time works, prove This algorithm is optimal, and then apply the same pattern to related problems.