Lecture 5 Dynamic Programming. Dynamic Programming Self-reducibility.

Slides:



Advertisements
Similar presentations
Dynamic Programming ACM Workshop 24 August Dynamic Programming Dynamic Programming is a programming technique that dramatically reduces the runtime.
Advertisements

Dynamic Programming.
Algorithm Design Methodologies Divide & Conquer Dynamic Programming Backtracking.
Dynamic Programming An algorithm design paradigm like divide-and-conquer “Programming”: A tabular method (not writing computer code) Divide-and-Conquer.
Partitioning and Divide-and-Conquer Strategies ITCS 4/5145 Parallel Computing, UNC-Charlotte, B. Wilkinson, Jan 23, 2013.
Overview What is Dynamic Programming? A Sequence of 4 Steps
Dynamic Programming.
S. J. Shyu Chap. 1 Introduction 1 The Design and Analysis of Algorithms Chapter 1 Introduction S. J. Shyu.
1 Divide & Conquer Algorithms. 2 Recursion Review A function that calls itself either directly or indirectly through another function Recursive solutions.
 2004 SDU Lecture11- All-pairs shortest paths. Dynamic programming Comparing to divide-and-conquer 1.Both partition the problem into sub-problems 2.Divide-and-conquer.
CS223 Advanced Data Structures and Algorithms 1 Divide and Conquer Neil Tang 4/15/2010.
1 Dynamic Programming Jose Rolim University of Geneva.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2006 Lecture 1 (Part 3) Design Patterns for Optimization Problems.
Dynamic Programming Carrie Williams. What is Dynamic Programming? Method of breaking the problem into smaller, simpler sub-problems Method of breaking.
Lecture 30 CSE 331 Nov 13, To be strictly enforced For the rest of the semester on Fridays SUBMIT your HOMEWORKS by 1:10 PM.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Spring, 2009 Design Patterns for Optimization Problems Dynamic Programming.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2002 Lecture 1 (Part 3) Tuesday, 9/3/02 Design Patterns for Optimization.
UNC Chapel Hill Lin/Manocha/Foskey Optimization Problems In which a set of choices must be made in order to arrive at an optimal (min/max) solution, subject.
Analysis of Algorithms CS 477/677
Lecture 34 CSE 331 Nov 30, Graded HW 8 On Wednesday.
Lecture 32 CSE 331 Nov 15, Feedback Forms Link for the survey on the blog.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Spring, 2002 Lecture 1 (Part 3) Tuesday, 1/29/02 Design Patterns for Optimization.
Optimal binary search trees
Analysis of Algorithms
11-1 Matrix-chain Multiplication Suppose we have a sequence or chain A 1, A 2, …, A n of n matrices to be multiplied –That is, we want to compute the product.
Unit 1. Sorting and Divide and Conquer. Lecture 1 Introduction to Algorithm and Sorting.
Dynamic Programming Introduction to Algorithms Dynamic Programming CSE 680 Prof. Roger Crawfis.
Algorithms and Data Structures Lecture X
October 21, Algorithms and Data Structures Lecture X Simonas Šaltenis Nykredit Center for Database Research Aalborg University
Dynamic Programming. Well known algorithm design techniques:. –Divide-and-conquer algorithms Another strategy for designing algorithms is dynamic programming.
Recursion and Dynamic Programming. Recursive thinking… Recursion is a method where the solution to a problem depends on solutions to smaller instances.
Fundamentals of Algorithms MCS - 2 Lecture # 7
Dynamic Programming Chapter 15 Highlights Charles Tappert Seidenberg School of CSIS, Pace University.
Dynamic Programming.
1 Designing algorithms There are many ways to design an algorithm. Insertion sort uses an incremental approach: having sorted the sub-array A[1…j - 1],
1 Summary: Design Methods for Algorithms Andreas Klappenecker.
Lecture 2 Sorting. Sorting Problem Insertion Sort, Merge Sort e.g.,
COSC 3101A - Design and Analysis of Algorithms 7 Dynamic Programming Assembly-Line Scheduling Matrix-Chain Multiplication Elements of DP Many of these.
1 CPSC 320: Intermediate Algorithm Design and Analysis July 28, 2014.
CS 8833 Algorithms Algorithms Dynamic Programming.
Algorithms: Design and Analysis Summer School 2013 at VIASM: Random Structures and Algorithms Lecture 4: Dynamic Programming Phan Th ị Hà D ươ ng 1.
Lecture 4 Sorting Networks. Comparator comparator.
Lecture 28 CSE 331 Nov 9, Mini project report due WED.
Optimization Problems In which a set of choices must be made in order to arrive at an optimal (min/max) solution, subject to some constraints. (There may.
Computer Sciences Department1.  Property 1: each node can have up to two successor nodes (children)  The predecessor node of a node is called its.
1 Ch.19 Divide and Conquer. 2 BIRD’S-EYE VIEW Divide and conquer algorithms Decompose a problem instance into several smaller independent instances May.
1 Today’s Material Dynamic Programming – Chapter 15 –Introduction to Dynamic Programming –0-1 Knapsack Problem –Longest Common Subsequence –Chain Matrix.
Chapter 15 Dynamic Programming Lee, Hsiu-Hui Ack: This presentation is based on the lecture slides from Hsu, Lih-Hsing, as well as various materials from.
 Design and Analysis of Algorithms تصميم وتحليل الخوارزميات (311 عال) Chapter 2 Sorting (insertion Sort, Merge Sort)
Sorting Quick, Merge & Radix Divide-and-conquer Technique subproblem 2 of size n/2 subproblem 1 of size n/2 a solution to subproblem 1 a solution to.
TU/e Algorithms (2IL15) – Lecture 3 1 DYNAMIC PROGRAMMING
Chapter 5 Guillotine Cut (1) Rectangular Partition Ding-Zhu Du.
TU/e Algorithms (2IL15) – Lecture 4 1 DYNAMIC PROGRAMMING II
Divide-and-Conquer Pattern ITCS 4/5145 Parallel Computing, UNC-Charlotte, B. Wilkinson, June 25, 2012 slides4.ppt. 4.1.
Lecture 2 Sorting.
Advanced Algorithms Analysis and Design
Lecture 5 Dynamic Programming
Unit 1. Sorting and Divide and Conquer
Lecture 4 Divide-and-Conquer
Advanced Design and Analysis Techniques
Lecture 5 Dynamic Programming
Lecture 9 Greedy Strategy
Ch. 15: Dynamic Programming Ming-Te Chi
Lecture 4 Dynamic Programming
Divide & Conquer Algorithms
Algorithms and Data Structures Lecture X
CSCI 235, Spring 2019, Lecture 25 Dynamic Programming
COMPSCI 330 Design and Analysis of Algorithms
Algorithms CSCI 235, Spring 2019 Lecture 27 Dynamic Programming II
Data Structures and Algorithms Dynamic Programming
Presentation transcript:

Lecture 5 Dynamic Programming

Dynamic Programming Self-reducibility

Divide and Conquer Divide the problem into subproblems. Conquer the subproblems by solving them recursively. Combine the solutions to subproblems into the solution for original problem.

Dynamic Programming Divide the problem into subproblems. Conquer the subproblems by solving them recursively. Combine the solutions to subproblems into the solution for original problem.

Remark on Divide and Conquer Key Point: Divide-and-Conquer is a DP-type technique.

Algorithms with Self-Reducibility Dynamic Programming Divide and Conquer Greedy Local Ratio

Matrix-chain Multiplication

Fully Parenthesize

Scalar Multiplications

# of scalar multiplications e.g.,

Step 1. Find recursive structure of optimal solution

Step 2. Build recursive formula about optimal value

Step 3. Computing optimal value

Step 4. Constructing an optimal solution

,125 11,87510,500 9,3757,1255,375 7,8754,3752,5003,500 15,7002, ,0005,

,125 11,87510,500 9,3757,1255,375 7,8754,3752,5003,500 15,7002, ,0005, (3) (5) (4)(3)(2) (1) Optimal solution

Running Time

How many recursive calls? How many m[I,j] will be computed?

# of Subproblems

Running Time

Remark on Running Time (1) Time for computing recursive formula. (2)The number of subproblems. (3) Multiplication of (1) and (2)

Longest Common Subsequence

Problem

Recursive Formula

More Examples

A Rectangle with holes NP-Hard!!!

Guillotine cut

Guillotine Partition A sequence of guillotine cuts Canonical one: every cut passes a hole.

Minimum length Guillotine Partition Given a rectangle with holes, partition it into smaller rectangles without hole to minimize the total length of guillotine cuts.

Minimum Guillotine Partition Dynamic programming In time O(n ): 5 Each cut has at most 2n choices. There are O(n ) subproblems. 4 Minimum guillotine partition can be a polynomial-time approximation.

What we learnt in this lecture? How to design dynamic programming. Two ways to implement. How to analyze running time.

Puzzle