08 - Introduction to dynamic programming; weighted interval scheduling

08 - Introduction to dynamic programming; weighted interval scheduling

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
.. Lecture: Introduction to dynamic programming; weighted interval scheduling Reading: Chapter 6.1 Chapter 6: Dynamic Programming First example: Weighted Interval Scheduling Goal: fnd a set o± non-overlapping o± max total weight (value) Intervals 1, 2, 3 . ... , n. Either interval n is in the optimal solution, or it isn't. I± it is: keep interval n, eliminate what it con²icts with Notation: For interval j, p(j) = highest labeled interval < j that doesn't con²ict with it (0 i± all earlier ones con²ict) In n isn't in optimal solution, solve recursively on 1, 2, 3, . .., n-1 Try: n in opt: get answer, n not in opt: get answer take better o± these Compute-Opt(n) I± n = 0 then return 0. Else return max [Vn + Compute-Opt(p(n)), Compute-Opt(n-1)] Can make an exponential number o± calls to Compute-Opt *But most o± these are redundant -- should save each recursive value frst time it's computed. Memoization
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/02/2008 for the course CS 482 taught by Professor Kleinberg during the Spring '08 term at Cornell University (Engineering School).

Page1 / 2

08 - Introduction to dynamic programming; weighted interval scheduling

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online