⚡ Build the skills to land top-paying quant jobs. Offer ends in 17d 22h 18m 45s17 days 22 hours 18 minutes 45 seconds.
⚡ Build the skills to land top-paying quant jobs. Offer ends in 17d 22h 18m 45s17 days 22 hours 18 minutes 45 seconds.

Sign in to watch this lesson
Advanced - Greedy and Scheduling · 4:18
Every job runs first on machine 1 for a and then on machine 2 for b, and we want machine 2 to finish as early as possible. The makespan is the sum of the b's plus machine 2's idle time, which an adjacent swap analysis turns into Johnson's rule: sort by min(a, b), send jobs with a < b to the front by increasing a and the rest to the back by decreasing b. We also see why the pairwise comparator is unsafe in std::sort and why three machines make the problem NP-hard.