1 / 9

Lecture 37

Lecture 37. CSE 331 Nov 4, 2009. Homework stuff. (Last!) HW 10 at the end of the lecture. Solutions to HW 9 on Monday. Graded HW 9 on Wednesday. http://xkcd.com/336/. Weighted Interval Scheduling. Input: n jobs ( s i ,t i ,v i ).

irisa
Download Presentation

Lecture 37

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lecture 37 CSE 331 Nov 4, 2009

  2. Homework stuff (Last!) HW 10 at the end of the lecture Solutions to HW 9 on Monday Graded HW 9 on Wednesday http://xkcd.com/336/

  3. Weighted Interval Scheduling Input: n jobs (si,ti,vi) Output: A schedule S s.t. no two jobs in S have a conflict Goal: max Σj in S vj Assume: jobs are sorted by their finish time

  4. Property of OPT OPT(j) = max {vj + OPT( p(j) ), OPT(j-1)}

  5. A recursive algorithm M-Compute-Opt(j) = OPT(j) M-Compute-Opt(j) If j = 0 then return 0 If M[j] is not null then return M[j] M[j] = max {vj + M-Compute-Opt( p(j) ), M-Compute-Opt( j-1 ) } return M[j] Run time = O(# recursive calls)

  6. Bounding # recursions M-Compute-Opt(j) O(n) overall If j = 0 then return 0 If M[j] is not null then return M[j] M[j] = max {vj + M-Compute-Opt( p(j) ), M-Compute-Opt( j-1 ) } return M[j] Whenever a recursive call is made an M value of assigned At most n values of M can be assigned

  7. Recursion+ memory = Iteration Iteratively compute the OPT(j) values Iterative-Compute-Opt M[0] = 0 For j=1,…,n M[j] = max {vj + M[p(j)], M[j-1] } M[j] = OPT(j) O(n) run time

  8. Reading Assignment Sec 6.1, 6.2 of [KT]

More Related