Advertisement
Guest User

Untitled

a guest
Apr 30th, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. Struct jobs{
  2. int deadline
  3. int penalty
  4. }
  5.  
  6. //Set jobs and penalty to objects to put in array called Latest_avail
  7. //Loop through and create array for jobs with deadlines
  8. for each i in job_source:
  9. Latest_avail[i] = i
  10. end
  11.  
  12. //Sort jobs according to largest penalty
  13. Sort(Latest_avail)
  14.  
  15. //loop through array to put jobs into the timeline
  16. for(i=0;time<amt_time; i++): //c++ for readability
  17. j = Latest_avail[i]->deadline //set j to the deadline
  18. for(k=j-1; k!=0; k--): //starting from deadline time,
  19. if timeline[k] is empty //check each spot in the timeline for a usable slot
  20. timeline[k] = Latest_avail[i]
  21. end
  22. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement