dynamicp

# dynamicp - CMSC 451: Dynamic Programming Slides By: Carl...

This preview shows pages 1–7. Sign up to view the full content.

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

View Full Document

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

View Full Document

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CMSC 451: Dynamic Programming Slides By: Carl Kingsford Department of Computer Science University of Maryland, College Park Based on Sections 6.1&amp;6.2 of Algorithm Design by Kleinberg &amp; Tardos. Dynamic Programming Dynamic Programming Our 3rd major algorithm design technique Similar to divide &amp; conquer Build up the answer from smaller subproblems More general than simple divide &amp; conquer Also more powerfulcy Generally applies to algorithms where the brute force algorithm would be exponential. Weighted Interval Scheduling Recall the interval scheduling problem weve seen several times: choose as many non-overlapping intervals as possible. What if each interval had a value? Problem (Weighted Interval Scheduling) Given a set of n intervals ( s i , f i ) , each with a value v i , choose a subset S of non-overlapping intervals with i S v i maximized. Example s1 f1 v3 = 1 v2 = 3 1 2 3 Note that our simple greedy algorithm for the unweighted case doesnt work. This is becasue some interval can be made very important with a high weight. Greedy Algorithm For Unweighted Case Greedy Algorithm For Unweighted Case: 1 Sort by increasing finishing time 2 Repeat until no intervals left: 1 Choose next interval 2 Remove all intervals it overlaps with Just look for the value of the OPT Suppose for now were not interested in the actual set of intervals. Only interested in the value of a solution (aka its cost, score, objective value)....
View Full Document

## This note was uploaded on 01/13/2012 for the course CMSC 423 taught by Professor Staff during the Fall '07 term at Maryland.

### Page1 / 31

dynamicp - CMSC 451: Dynamic Programming Slides By: Carl...

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

View Full Document
Ask a homework question - tutors are online