Skip to content

Instantly share code, notes, and snippets.

@kartikkukreja
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kartikkukreja/19fce114ea6e4232e789 to your computer and use it in GitHub Desktop.
Save kartikkukreja/19fce114ea6e4232e789 to your computer and use it in GitHub Desktop.
Interval Partitioning Problem
Let R be the set of all requests
Let d = 0 be the number of resources
while !R.empty():
Choose a request i ∈ R that has the earliest start time
if i can be assigned to some resource k <= d:
assign request i to resource k
else:
allocate a new resource d+1
assign request i to resource d+1
d = d + 1
return d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment