Lec20 - MIT OpenCourseWare http/ocw.mit.edu 6.006 Introduction to Algorithms Spring 2008 For information about citing these materials or our Terms

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon
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 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 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 ≤ k ≤ n = min path s → t trick from card(i) using ≤ k edges subprobs: Θ( n ) Θ( V 2 ) Θ( n ) guessing: none edge from...
View Full Document

This note was uploaded on 09/24/2010 for the course CS 6.006 taught by Professor Erikdemaine during the Spring '08 term at MIT.

Page1 / 6

Lec20 - MIT OpenCourseWare http/ocw.mit.edu 6.006 Introduction to Algorithms Spring 2008 For information about citing these materials or our Terms

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

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