Module 13 · Greedy · Greedy Approach

Job sequencing problem

Take the jobs from the highest profit down. Each one gets the latest free day on or before its deadline: doing it as late as allowed keeps the earlier days free for jobs that are due sooner. A job with every day up to its deadline taken is dropped.

jobs shows each job's profit, with its name and deadline under it, in the order they are tried. slots holds one place per day; day walks back from the job's deadline to the first free one.