Sitelet https://web.archive.org/web/20201023042107/https://github.com/SleekPanther/interval-scheduling
Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

README.md

Interval Scheduling

Greedy Algorithm to find the maximum number of mutually compatible jobs

Problem Statement

  • Job j starts at s(j) and finishes at f(j)
  • 2 jobs are compatible if they do not overlap (2nd job starts after or at the same time as the 1st one finishes)
  • Goal: find the maximum number of mutually compatible jobs
  • Example: 8 jobs {a, b, c, d, e, f, g, h}

Optimal = {b, e, h}

Algorithm

Consider jobs in ascending order of finish time f(j)

Sorted Jobs

Pseudocode

Runtime

Sorting O(n log(n)) + for-loop Θ(n)
O(n log(n))

References

You can’t perform that action at this time.