Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Struct jobs{
- int deadline
- int penalty
- }
- //Set jobs and penalty to objects to put in array called Latest_avail
- //Loop through and create array for jobs with deadlines
- for each i in job_source:
- Latest_avail[i] = i
- end
- //Sort jobs according to largest penalty
- Sort(Latest_avail)
- //loop through array to put jobs into the timeline
- for(i=0;time<amt_time; i++): //c++ for readability
- j = Latest_avail[i]->deadline //set j to the deadline
- for(k=j-1; k!=0; k--): //starting from deadline time,
- if timeline[k] is empty //check each spot in the timeline for a usable slot
- timeline[k] = Latest_avail[i]
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement