CSCI-256 Data Structures & Algorithm Analysis Lecture Note: Some slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. 20.

Slides:



Advertisements
Similar presentations
1 Chapter 6 Dynamic Programming Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
Advertisements

Overview What is Dynamic Programming? A Sequence of 4 Steps
9/27/10 A. Smith; based on slides by E. Demaine, C. Leiserson, S. Raskhodnikova, K. Wayne Adam Smith Algorithm Design and Analysis L ECTURE 14 Dynamic.
Chapter 7 Dynamic Programming.
CSCI 256 Data Structures and Algorithm Analysis Lecture 13 Some slides by Kevin Wayne copyright 2005, Pearson Addison Wesley all rights reserved, and some.
6 - 1 Chapter 6 The Secondary Structure Prediction of RNA.
Greedy Algorithms Basic idea Connection to dynamic programming Proof Techniques.
Dynamic Programming1. 2 Outline and Reading Matrix Chain-Product (§5.3.1) The General Technique (§5.3.2) 0-1 Knapsack Problem (§5.3.3)
Lecture 38 CSE 331 Dec 3, A new grading proposal Towards your final score in the course MAX ( mid-term as 25%+ finals as 40%, finals as 65%) .
CSC401 – Analysis of Algorithms Lecture Notes 12 Dynamic Programming
CSE 421 Algorithms Richard Anderson Lecture 16 Dynamic Programming.
7 -1 Chapter 7 Dynamic Programming Fibonacci Sequence Fibonacci sequence: 0, 1, 1, 2, 3, 5, 8, 13, 21, … F i = i if i  1 F i = F i-1 + F i-2 if.
Lecture 36 CSE 331 Dec 2, Graded HW 8 END of the lecture.
Sandia is a multiprogram laboratory operated by Sandia Corporation, a Lockheed Martin Company, for the United States Department of Energy under contract.
KNAPSACK PROBLEM A dynamic approach. Knapsack Problem  Given a sack, able to hold K kg  Given a list of objects  Each has a weight and a value  Try.
Sandia is a multiprogram laboratory operated by Sandia Corporation, a Lockheed Martin Company, for the United States Department of Energy under contract.
Lecture 37 CSE 331 Dec 1, A new grading proposal Towards your final score in the course MAX ( mid-term as 25%+ finals as 40%, finals as 65%) .
1 Algorithmic Paradigms Greed. Build up a solution incrementally, myopically optimizing some local criterion. Divide-and-conquer. Break up a problem into.
Dynamic Programming Adapted from Introduction and Algorithms by Kleinberg and Tardos.
CSCI-256 Data Structures & Algorithm Analysis Lecture Note: Some slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. 22.
1 Algorithmic Paradigms Greed. Build up a solution incrementally, myopically optimizing some local criterion. Divide-and-conquer. Break up a problem into.
CSCI 256 Data Structures and Algorithm Analysis Lecture 14 Some slides by Kevin Wayne copyright 2005, Pearson Addison Wesley all rights reserved, and some.
CSCI-256 Data Structures & Algorithm Analysis Lecture Note: Some slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. 8.
CSCI-256 Data Structures & Algorithm Analysis Lecture Note: Some slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. 33.
CSC401: Analysis of Algorithms CSC401 – Analysis of Algorithms Chapter Dynamic Programming Objectives: Present the Dynamic Programming paradigm.
CSCI-256 Data Structures & Algorithm Analysis Lecture Note: Some slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. 17.
Prof. Swarat Chaudhuri COMP 482: Design and Analysis of Algorithms Spring 2012 Lecture 17.
6/4/ ITCS 6114 Dynamic programming Longest Common Subsequence.
Honors Track: Competitive Programming & Problem Solving Optimization Problems Kevin Verbeek.
Prof. Swarat Chaudhuri COMP 482: Design and Analysis of Algorithms Spring 2012 Lecture 16.
1 Chapter 6 Dynamic Programming. 2 Algorithmic Paradigms Greedy. Build up a solution incrementally, optimizing some local criterion. Divide-and-conquer.
1 Chapter 6 Dynamic Programming Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
Analysis of Algorithms CS 477/677 Instructor: Monica Nicolescu Lecture 14.
1 Chapter 6-1 Dynamic Programming Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
Chapter 6 Dynamic Programming
Dynamic Programming1. 2 Outline and Reading Matrix Chain-Product (§5.3.1) The General Technique (§5.3.2) 0-1 Knapsack Problem (§5.3.3)
Dynamic Programming.  Decomposes a problem into a series of sub- problems  Builds up correct solutions to larger and larger sub- problems  Examples.
1 Chapter 6 Dynamic Programming Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
Dynamic Programming … Continued 0-1 Knapsack Problem.
CSCI-256 Data Structures & Algorithm Analysis Lecture Note: Some slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. 18.
CSCI-256 Data Structures & Algorithm Analysis Lecture Note: Some slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. 21.
CSCI 256 Data Structures and Algorithm Analysis Lecture 16 Some slides by Kevin Wayne copyright 2005, Pearson Addison Wesley all rights reserved, and some.
Dynamic Programming … Continued
Lecture 33 CSE 331 Nov 20, HW 8 due today Place Q1, Q2 and Q3 in separate piles I will not accept HWs after 1:15pm Submit your HWs to the side of.
1 Algorithms CSCI 235, Fall 2015 Lecture 29 Greedy Algorithms.
TU/e Algorithms (2IL15) – Lecture 4 1 DYNAMIC PROGRAMMING II
Chapter 6 Dynamic Programming
Lecture 32 CSE 331 Nov 16, 2016.
Richard Anderson Lecture 17 Dynamic Programming
Chapter 6 Dynamic Programming
Richard Anderson Lecture 16 Dynamic Programming
Richard Anderson Lecture 16a Dynamic Programming
Richard Anderson Lecture 16 Dynamic Programming
Dynamic Programming Dynamic Programming 1/18/ :45 AM
Dynamic Programming Merge Sort 1/18/ :45 AM Spring 2007
Dynamic Programming Longest Path in a DAG, Yin Tat Lee
Longest Common Subsequence
Lecture 32 CSE 331 Nov 15, 2017.
Chapter 6 Dynamic Programming
Chapter 6 Dynamic Programming
Algorithms CSCI 235, Spring 2019 Lecture 29 Greedy Algorithms
Lecture 36 CSE 331 Nov 28, 2011.
Lecture 36 CSE 331 Nov 30, 2012.
Dynamic Programming II DP over Intervals
Merge Sort 4/28/ :13 AM Dynamic Programming Dynamic Programming.
Richard Anderson Lecture 16, Winter 2019 Dynamic Programming
Lecture 5 Dynamic Programming
Dynamic Programming Merge Sort 5/23/2019 6:18 PM Spring 2008
Data Structures and Algorithm Analysis Lecture 15
Presentation transcript:

CSCI-256 Data Structures & Algorithm Analysis Lecture Note: Some slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. 20

Dynamic Programming Review Recipe –Characterize structure of problem –Recursively define value of optimal solution –Compute value of optimal solution –Construct optimal solution from computed information Dynamic programming techniques –Binary choice: weighted interval scheduling –Multi-way choice: segmented least squares –Adding a new variable: knapsack –Dynamic programming over intervals: RNA secondary structure

RNA Secondary Structure RNA: String B = b 1 b 2  b n over alphabet { A, C, G, U } Secondary structure: RNA is single-stranded so it tends to loop back and form base pairs with itself. This structure is essential for understanding behavior of molecule G U C A GA A G CG A U G A U U A G A CA A C U G A G U C A U C G G G C C G Ex: GUCGAUUGAGCGAAUGUAACAACGUGGCUACGGCGAGA complementary base pairs: A-U, C-G

RNA Secondary Structure Secondary structure: A set of pairs S = { (b i, b j ) } that satisfy –[Watson-Crick] S is a matching and each pair in S is a Watson-Crick complement: A-U, U-A, C-G, or G-C –[No sharp turns] The ends of each pair are separated by at least 4 intervening bases. If (b i, b j )  S, then i < j - 4 –[Non-crossing] If (b i, b j ) and (b k, b l ) are two pairs in S, then we cannot have i < k < j < l C GG C A G U U UA A UGUGGCCAU ok GG C A G U UA G A UGGGCAU sharp turn G 44 C GG C A U G U UA A GUUGGCCAU crossing

RNA Secondary Structure Out of all the secondary structures that are possible for a single RNA molecule, which are the ones that are likely to arise? –Free energy: Usual hypothesis is that an RNA molecule will form the secondary structure with the optimum total free energy –Goal: Given an RNA molecule B = b 1 b 2  b n, find a secondary structure S that maximizes the number of base pairs approximate by number of base pairs

RNA Secondary Structure: Subproblems First attempt: OPT(j) = maximum number of base pairs in a secondary structure of the substring b 1 b 2  b j. Either –j is not involved in a pair Finding secondary structure in: b 1 b 2  b j-1 –j pairs with t for some t < j – 4 Finding secondary structure in: b 1 b 2  b t-1 Finding secondary structure in: b t+1 b t+2  b j-1 OPT(j-1) 1 tj WHY ? Not on our list of subproblems, does not begin with b 1. Need more subproblems! Need to be able to work with subproblems that do not begin with b 1.

Dynamic Programming Over Intervals Notation: OPT(i, j) = maximum number of base pairs in a secondary structure of the substring b i b i+1  b j –Case 1: If i  j - 4 OPT(i, j) = 0 by no-sharp turns condition –Case 2: Base b j is not involved in a pair OPT(i, j) = OPT(i, j-1) –Case 3: Base b j pairs with b t for some i  t < j - 4 non-crossing constraint decouples resulting sub-problems OPT(i, j) = 1 + max t { OPT(i, t-1) + OPT(t+1, j-1) } i tj take max over t such that i  t < j-4 and b t and b j are Watson-Crick complements

Dynamic Programming Over Intervals Write down final recurrence (DONE IN CLASS) What order to solve the sub-problems? –Do shortest intervals first –Running time: O(n 3 ) –Example: ACCGGUAGU (DONE IN CLASS) RNA(b 1,…,b n ) { Initialize Opt[i, j] = 0 whenever i  j-4 for k = 5, 6, …, n-1 for i = 1, 2, …, n-k j = i + k Compute Opt[i, j] return Opt[1, n] } using recurrence