# lec19 - 6.006 6.006 Introduction to Algorithms to...

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

6.006- Introduction to Algorithms 6.006 Lecture 19 Dynamic Programming II Prof Manolis Kellis Prof. Manolis Kellis CLRS 15.4, 25.1, 25.2

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

View Full Document
Course VI - 6.006 – Module VI – This is it Dynamic Programming 2
Dynamic Programming • Optimization technique widely applicable Optimization technique, widely applicable Optimal substructure Overlapping subproblems Tuesday: Simple examples alignment Tuesday: Simple examples, alignment – Fibonacci: top-down vs. bottom-up C Ei ht di i l ti i ti – Crazy Eights: one-dimensional optimization Today: More DP Ali t Edit di t l l l ti – Alignment: Edit distance, molecular evolution – Back to paths: All Pairs Shortest Paths DP1,DP2 N t k Next week: – Knapsack (shopping cart) problem f – Text Justification – Structured DP: Vertex Cover on trees, phylogeny

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

View Full Document
Today: Dynamic programming II O i l b d b bl Optimal sub-structure, repeated subproblems Review: Simple DP problems – Fibonacci numbers: Top-down vs. bottom-up – Crazy Eights: One-dimensional optimization LCS, Edit Distance, Sequence alignment – Two-dimensional optimization: Matrix/path duality Two dimensional optimization: Matrix/path duality – Setting up the recurrence, Fill Matrix, Traceback • All pairs shortest paths (naïve: 2 n n*BelFo: n 4 ) All pairs shortest paths (naïve: 2 . n BelFo: n – Representing solutions. Two ways to set up DP Matrix multiplication: n 3 lgn Floyd Warshall: n 3 – Matrix multiplication: n lgn. Floyd-Warshall: n