Greedy Algorithms8 sections · 316 units
Open in Course

Proof Step 1 - First Activity

The greedy choice

Let g1g_1 be greedy's first activity (ends earliest) and o1o_1 be OPT's first activity.

Case 11: o1=g1o_1 = g_1. No change needed. Both agree on the first activity.

Case 22: o1g1o_1 \neq g_1. Since g1g_1 ends earliest, end(g1)end(o1)end(g_1) \leq end(o_1). Replace o1o_1 with g1g_1 in OPT to create OPT'. Is OPT' valid? Yes! Since g1g_1 ends no later than o1o_1, it cannot conflict with OPT's second activity (which starts after P10 ends). OPT' has the same count as OPT.