{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

lec19

# lec19 - MIT OpenCourseWare http/ocw.mit.edu 6.006...

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

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: MIT OpenCourseWare http://ocw.mit.edu 6.006 Introduction to Algorithms Spring 2008 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms . Lecture 19 Dynamic Programming I of IV 6.006 Spring 2008 Lecture 19: Dynamic Programming I: Memoization, Fibonacci, Crazy Eights, Guessing Lecture Overview • Fibonacci Warmup • Memoization and subproblems Shortest Paths • • Crazy Eights • Guessing Viewpoint Readings CLRS 15 Dynamic Programming (DP) Big idea: :hard yet simple • Powerful algorithmic design technique • Large class of seemingly exponential problems have a polynomial solution (“only”) via DP • Particularly for optimization problems (min / max) (e.g., shortest paths) * DP ≈ “controlled brute force” * DP ≈ recursion + re-use Fibonacci Numbers F 1 = F 2 = 1; F n = F n − 1 + F n − 2 Naive Algorithm follow recursive definition fib( n ): if n ≤ 2: return 1 else return fib( n − 1) + fib( n − 2) = ⇒ T ( n ) = T (...
View Full Document

{[ snackBarMessage ]}

### Page1 / 5

lec19 - MIT OpenCourseWare http/ocw.mit.edu 6.006...

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

View Full Document
Ask a homework question - tutors are online