{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

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

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

View Full Document Right Arrow Icon
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 .
Background image of page 1

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

View Full Document Right Arrow Icon
�� Lecture 20 Dynamic Programming II of IV 6.006 Spring 2008 Lecture 20: Dynamic Programming II: Longest Common Subsequence, Parent Pointers Lecture Overview Review of big ideas & examples so far Bottom-up implementation Longest common subsequence Parent pointers for guesses Readings CLRS 15 Summary * DP “controlled brute force” * DP guessing + recursion + memoization * DP dividing into reasonable subproblems whose solutions relate - acyclicly - usually via guessing parts of solution. * time = subproblems × time/subproblem treating recursive calls as O (1) (usually mainly guessing) essentially an amortization count each subproblem only once; after first time, costs O (1) via memoization 1
Background image of page 2
Lecture 20 Dynamic Programming II of IV 6.006 Spring 2008 Examples: Fibonacci Shortest Paths Crazy Eights subprobs: fib( k ) δ k ( s, t ) s, k < n trick(i) = longest 0 k n = min path s t trick from card(i) using k edges subprobs: Θ( n ) Θ( V 2 ) Θ( n ) guessing: none edge
Background image of page 3

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

View Full Document Right Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}