Greedy Algorithms8 sections · 316 units
Open in Course

Why Weighted Needs DP

A counterexample

Activities: [(11, 33, 22), (22, 55, 44), (44, 66, 44)]. Greedy by end time: (1,3) then (4,6). Total: 22 + 44 = 66. Alternative: just (2,5). Total: 44. Worse. Greedy wins again. Let me find a real counterexample..

Activities: [(00, 44, 33), (33, 55, 55), (44, 77, 22)]. Greedy: (0,4) then (4,7). Total: 55. Alternative: (3,5) alone. Total: 55. Tie. The point: with weights, the greedy choice property can fail. Use DP for weighted cases.