Price your future right. 60% off with code BLACKSCHOLES at USD checkout. Offer ends in 1d 16h 01m 36s1 days 16 hours 1 minutes 36 seconds.
Price your future right. 60% off with code BLACKSCHOLES at USD checkout. Offer ends in 1d 16h 01m 36s1 days 16 hours 1 minutes 36 seconds.

Sign in to watch this lesson
Advanced - Greedy and Scheduling · 3:57
Each job has a duration and a deadline, runs without interruption, and counts only if it finishes on time. Scanning by deadline with a max-heap and dropping the longest job whenever the clock runs late (Moore–Hodgson) maximizes the count, and a backward sweep over the gaps between deadlines reaches the same answer. Unit tasks with profits use a latest-free-slot greedy instead, while durations and profits together are NP-hard.