Skip to content

Instantly share code, notes, and snippets.

@kartikkukreja
Last active August 29, 2015 14:04
Show Gist options
  • Select an option

  • Save kartikkukreja/f530d0dcea0582756be2 to your computer and use it in GitHub Desktop.

Select an option

Save kartikkukreja/f530d0dcea0582756be2 to your computer and use it in GitHub Desktop.
Interval Scheduling Problem Algorithm
Let R be the set of all requests
schedule = {}
while !R.empty():
Choose a request i ∈ R that has the smallest finish time
Add i to schedule
Delete all requests from R that are incompatible with i
return schedule
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment