SlideShare a Scribd company logo
CS 321. Algorithm Analysis & Design
Lecture 14
Dynamic Programming
Edit Distance Revisited
Longest Increasing Subsequence
Matrix Chain Multiplication
A L G O R I T H M
A
L
T
R
U
I
S
T
I
C
A L G O R I T H M
A
L
T
R
U
I
S
T
I
C
A L G O R
A L T R U
A L T R U
A L G O R
A L T R U
RA L T R U
Cost of converting ALGO to ALTRU
+
Cost of deleting R from the end
A L G O R
A L T R U
A L G O R
A L T R U
A L T R U
A L T R
Cost of converting ALGOR to ALTR
+
Cost of inserting U at the end
A L G O R
A L T R U
A L T R
A L G O R
U
RA L T R
Cost of converting ALGO to ALTR
+
Cost of replacing R with U
A L T R U
U
To find the edit distance between
ALGOR and ALTRU…
or convert ALGO to ALTRU and delete R
or convert ALGO to ALTR and replace R with U
Either convert ALGOR to ALTR and insert U
Longest Increasing Subsequence
1, 2, 3, 9, 4, 5, 10, 6, 7, 12, 13, 14, 8, 6, 17
1, 2, 3, 9, 4, 5, 10, 6, 7, 12, 13, 14, 8, 6, 17
1, 2, 3, 9, 4, 5, 10, 6, 7, 12, 13, 14, 8, 6, 17
LIS[i] = longest increasing subsequence
of the array L[1…i].
(What we want)
(Build up the array bottom to top.)
A = [a1, a2, … , ai, … , an]
LIS[i] = max(LIS[i-1] + 1, LIS[i-1])
LIS[i,j] = LIS of A[1…i]
where all elements are at most A[j].
(What we want)
(Build up the array bottom to top.)
A = [a1, a2, … , ai, … , an]
LIS[i,j] = LIS[i-1,j] or max(LIS[i-1,i] + 1, LIS[i-1,j])

More Related Content

What's hot

Backtracking & branch and bound
Backtracking & branch and boundBacktracking & branch and bound
Backtracking & branch and bound
Vipul Chauhan
 
Euclid's Algorithm for Greatest Common Divisor - Time Complexity Analysis
Euclid's Algorithm for Greatest Common Divisor - Time Complexity AnalysisEuclid's Algorithm for Greatest Common Divisor - Time Complexity Analysis
Euclid's Algorithm for Greatest Common Divisor - Time Complexity Analysis
Amrinder Arora
 
Parallelising Dynamic Programming
Parallelising Dynamic ProgrammingParallelising Dynamic Programming
Parallelising Dynamic Programming
Raphael Reitzig
 
Lecture26
Lecture26Lecture26
Asymptotic analysis
Asymptotic analysisAsymptotic analysis
Asymptotic analysis
Nisha Soms
 
Design and Analysis of Algorithms
Design and Analysis of AlgorithmsDesign and Analysis of Algorithms
Design and Analysis of Algorithms
Arvind Krishnaa
 
Lecture 1
Lecture 1Lecture 1
Lecture 1
guest6c6268
 
Big oh Representation Used in Time complexities
Big oh Representation Used in Time complexitiesBig oh Representation Used in Time complexities
Big oh Representation Used in Time complexities
LAKSHMITHARUN PONNAM
 
Find Transitive Closure Using Floyd-Warshall Algorithm
Find Transitive Closure Using Floyd-Warshall AlgorithmFind Transitive Closure Using Floyd-Warshall Algorithm
Find Transitive Closure Using Floyd-Warshall Algorithm
Rajib Roy
 
Bron Kerbosch Algorithm - Presentation by Jun Zhai, Tianhang Qiang and Yizhen...
Bron Kerbosch Algorithm - Presentation by Jun Zhai, Tianhang Qiang and Yizhen...Bron Kerbosch Algorithm - Presentation by Jun Zhai, Tianhang Qiang and Yizhen...
Bron Kerbosch Algorithm - Presentation by Jun Zhai, Tianhang Qiang and Yizhen...
Amrinder Arora
 
Aaex4 group2(中英夾雜)
Aaex4 group2(中英夾雜)Aaex4 group2(中英夾雜)
Aaex4 group2(中英夾雜)
Shiang-Yun Yang
 
Q-Metrics in Theory And Practice
Q-Metrics in Theory And PracticeQ-Metrics in Theory And Practice
Q-Metrics in Theory And Practice
guest3550292
 
Algorithms explained
Algorithms explainedAlgorithms explained
Algorithms explained
PIYUSH Dubey
 
Aaex7 group2(中英夾雜)
Aaex7 group2(中英夾雜)Aaex7 group2(中英夾雜)
Aaex7 group2(中英夾雜)
Shiang-Yun Yang
 
Programming workshop
Programming workshopProgramming workshop
Programming workshop
Sandeep Joshi
 
DSP System Assignment Help
DSP System Assignment HelpDSP System Assignment Help
DSP System Assignment Help
Matlab Assignment Experts
 
Aaex5 group2(中英夾雜)
Aaex5 group2(中英夾雜)Aaex5 group2(中英夾雜)
Aaex5 group2(中英夾雜)
Shiang-Yun Yang
 
Theory of automata and formal languages Unit 4
Theory of automata and formal languages Unit 4Theory of automata and formal languages Unit 4
Theory of automata and formal languages Unit 4
Abhimanyu Mishra
 
Algorithm big o
Algorithm big oAlgorithm big o
Algorithm big o
Ashim Lamichhane
 
Transportation and assignment_problem
Transportation and assignment_problemTransportation and assignment_problem
Transportation and assignment_problem
Ankit Katiyar
 

What's hot (20)

Backtracking & branch and bound
Backtracking & branch and boundBacktracking & branch and bound
Backtracking & branch and bound
 
Euclid's Algorithm for Greatest Common Divisor - Time Complexity Analysis
Euclid's Algorithm for Greatest Common Divisor - Time Complexity AnalysisEuclid's Algorithm for Greatest Common Divisor - Time Complexity Analysis
Euclid's Algorithm for Greatest Common Divisor - Time Complexity Analysis
 
Parallelising Dynamic Programming
Parallelising Dynamic ProgrammingParallelising Dynamic Programming
Parallelising Dynamic Programming
 
Lecture26
Lecture26Lecture26
Lecture26
 
Asymptotic analysis
Asymptotic analysisAsymptotic analysis
Asymptotic analysis
 
Design and Analysis of Algorithms
Design and Analysis of AlgorithmsDesign and Analysis of Algorithms
Design and Analysis of Algorithms
 
Lecture 1
Lecture 1Lecture 1
Lecture 1
 
Big oh Representation Used in Time complexities
Big oh Representation Used in Time complexitiesBig oh Representation Used in Time complexities
Big oh Representation Used in Time complexities
 
Find Transitive Closure Using Floyd-Warshall Algorithm
Find Transitive Closure Using Floyd-Warshall AlgorithmFind Transitive Closure Using Floyd-Warshall Algorithm
Find Transitive Closure Using Floyd-Warshall Algorithm
 
Bron Kerbosch Algorithm - Presentation by Jun Zhai, Tianhang Qiang and Yizhen...
Bron Kerbosch Algorithm - Presentation by Jun Zhai, Tianhang Qiang and Yizhen...Bron Kerbosch Algorithm - Presentation by Jun Zhai, Tianhang Qiang and Yizhen...
Bron Kerbosch Algorithm - Presentation by Jun Zhai, Tianhang Qiang and Yizhen...
 
Aaex4 group2(中英夾雜)
Aaex4 group2(中英夾雜)Aaex4 group2(中英夾雜)
Aaex4 group2(中英夾雜)
 
Q-Metrics in Theory And Practice
Q-Metrics in Theory And PracticeQ-Metrics in Theory And Practice
Q-Metrics in Theory And Practice
 
Algorithms explained
Algorithms explainedAlgorithms explained
Algorithms explained
 
Aaex7 group2(中英夾雜)
Aaex7 group2(中英夾雜)Aaex7 group2(中英夾雜)
Aaex7 group2(中英夾雜)
 
Programming workshop
Programming workshopProgramming workshop
Programming workshop
 
DSP System Assignment Help
DSP System Assignment HelpDSP System Assignment Help
DSP System Assignment Help
 
Aaex5 group2(中英夾雜)
Aaex5 group2(中英夾雜)Aaex5 group2(中英夾雜)
Aaex5 group2(中英夾雜)
 
Theory of automata and formal languages Unit 4
Theory of automata and formal languages Unit 4Theory of automata and formal languages Unit 4
Theory of automata and formal languages Unit 4
 
Algorithm big o
Algorithm big oAlgorithm big o
Algorithm big o
 
Transportation and assignment_problem
Transportation and assignment_problemTransportation and assignment_problem
Transportation and assignment_problem
 

Viewers also liked

Dynamic Programming - Matrix Chain Multiplication
Dynamic Programming - Matrix Chain MultiplicationDynamic Programming - Matrix Chain Multiplication
Dynamic Programming - Matrix Chain Multiplication
Pecha Inc.
 
Rabin karp string matching algorithm
Rabin karp string matching algorithmRabin karp string matching algorithm
Rabin karp string matching algorithm
Gajanand Sharma
 
Dynamic programming
Dynamic programmingDynamic programming
Dynamic programming
Shakil Ahmed
 
5.3 dynamic programming 03
5.3 dynamic programming 035.3 dynamic programming 03
5.3 dynamic programming 03
Krish_ver2
 
Longest Common Subsequence (LCS) Algorithm
Longest Common Subsequence (LCS) AlgorithmLongest Common Subsequence (LCS) Algorithm
Longest Common Subsequence (LCS) Algorithm
Darshit Metaliya
 
Dynamic Programming
Dynamic ProgrammingDynamic Programming
Dynamic Programming
paramalways
 
The Top Skills That Can Get You Hired in 2017
The Top Skills That Can Get You Hired in 2017The Top Skills That Can Get You Hired in 2017
The Top Skills That Can Get You Hired in 2017
LinkedIn
 

Viewers also liked (7)

Dynamic Programming - Matrix Chain Multiplication
Dynamic Programming - Matrix Chain MultiplicationDynamic Programming - Matrix Chain Multiplication
Dynamic Programming - Matrix Chain Multiplication
 
Rabin karp string matching algorithm
Rabin karp string matching algorithmRabin karp string matching algorithm
Rabin karp string matching algorithm
 
Dynamic programming
Dynamic programmingDynamic programming
Dynamic programming
 
5.3 dynamic programming 03
5.3 dynamic programming 035.3 dynamic programming 03
5.3 dynamic programming 03
 
Longest Common Subsequence (LCS) Algorithm
Longest Common Subsequence (LCS) AlgorithmLongest Common Subsequence (LCS) Algorithm
Longest Common Subsequence (LCS) Algorithm
 
Dynamic Programming
Dynamic ProgrammingDynamic Programming
Dynamic Programming
 
The Top Skills That Can Get You Hired in 2017
The Top Skills That Can Get You Hired in 2017The Top Skills That Can Get You Hired in 2017
The Top Skills That Can Get You Hired in 2017
 

Similar to 14 - 08 Feb - Dynamic Programming

Real World Haskell: Lecture 7
Real World Haskell: Lecture 7Real World Haskell: Lecture 7
Real World Haskell: Lecture 7
Bryan O'Sullivan
 
Analysis of algorithms
Analysis of algorithms Analysis of algorithms
Analysis of algorithms
MUSAIDRIS15
 
Anlysis and design of algorithms part 1
Anlysis and design of algorithms part 1Anlysis and design of algorithms part 1
Anlysis and design of algorithms part 1
Deepak John
 
Insersion & Bubble Sort in Algoritm
Insersion & Bubble Sort in AlgoritmInsersion & Bubble Sort in Algoritm
Insersion & Bubble Sort in Algoritm
Ehsan Ehrari
 
Algorithm Complexity and Main Concepts
Algorithm Complexity and Main ConceptsAlgorithm Complexity and Main Concepts
Algorithm Complexity and Main Concepts
Adelina Ahadova
 
Introduction to Algorithms
Introduction to AlgorithmsIntroduction to Algorithms
Introduction to Algorithms
Venkatesh Iyer
 
Implementing External DSLs Using Scala Parser Combinators
Implementing External DSLs Using Scala Parser CombinatorsImplementing External DSLs Using Scala Parser Combinators
Implementing External DSLs Using Scala Parser Combinators
Tim Dalton
 
QR Factorizations and SVDs for Tall-and-skinny Matrices in MapReduce Architec...
QR Factorizations and SVDs for Tall-and-skinny Matrices in MapReduce Architec...QR Factorizations and SVDs for Tall-and-skinny Matrices in MapReduce Architec...
QR Factorizations and SVDs for Tall-and-skinny Matrices in MapReduce Architec...
Austin Benson
 
Data structures notes for college students btech.pptx
Data structures notes for college students btech.pptxData structures notes for college students btech.pptx
Data structures notes for college students btech.pptx
KarthikVijay59
 
Introduction to Compiler Development
Introduction to Compiler DevelopmentIntroduction to Compiler Development
Introduction to Compiler Development
Logan Chien
 
Beginner workshop to angularjs presentation at Google
Beginner workshop to angularjs presentation at GoogleBeginner workshop to angularjs presentation at Google
Beginner workshop to angularjs presentation at Google
Ari Lerner
 
Scribed lec8
Scribed lec8Scribed lec8
Scribed lec8
Praveen Kumar
 
Scala as a Declarative Language
Scala as a Declarative LanguageScala as a Declarative Language
Scala as a Declarative Language
vsssuresh
 
Home workassignment01 google docs
Home workassignment01   google docsHome workassignment01   google docs
DBMS CS3
DBMS CS3DBMS CS3
Introduction to Erlang
Introduction to ErlangIntroduction to Erlang
Introduction to Erlang
Corrado Santoro
 
Groovy
GroovyGroovy
Groovy
Zen Urban
 
Loops_in_Rv1.2b
Loops_in_Rv1.2bLoops_in_Rv1.2b
Loops_in_Rv1.2b
Carlo Fanara
 
A0750105
A0750105A0750105
A0750105
IOSR Journals
 
Eta
EtaEta

Similar to 14 - 08 Feb - Dynamic Programming (20)

Real World Haskell: Lecture 7
Real World Haskell: Lecture 7Real World Haskell: Lecture 7
Real World Haskell: Lecture 7
 
Analysis of algorithms
Analysis of algorithms Analysis of algorithms
Analysis of algorithms
 
Anlysis and design of algorithms part 1
Anlysis and design of algorithms part 1Anlysis and design of algorithms part 1
Anlysis and design of algorithms part 1
 
Insersion & Bubble Sort in Algoritm
Insersion & Bubble Sort in AlgoritmInsersion & Bubble Sort in Algoritm
Insersion & Bubble Sort in Algoritm
 
Algorithm Complexity and Main Concepts
Algorithm Complexity and Main ConceptsAlgorithm Complexity and Main Concepts
Algorithm Complexity and Main Concepts
 
Introduction to Algorithms
Introduction to AlgorithmsIntroduction to Algorithms
Introduction to Algorithms
 
Implementing External DSLs Using Scala Parser Combinators
Implementing External DSLs Using Scala Parser CombinatorsImplementing External DSLs Using Scala Parser Combinators
Implementing External DSLs Using Scala Parser Combinators
 
QR Factorizations and SVDs for Tall-and-skinny Matrices in MapReduce Architec...
QR Factorizations and SVDs for Tall-and-skinny Matrices in MapReduce Architec...QR Factorizations and SVDs for Tall-and-skinny Matrices in MapReduce Architec...
QR Factorizations and SVDs for Tall-and-skinny Matrices in MapReduce Architec...
 
Data structures notes for college students btech.pptx
Data structures notes for college students btech.pptxData structures notes for college students btech.pptx
Data structures notes for college students btech.pptx
 
Introduction to Compiler Development
Introduction to Compiler DevelopmentIntroduction to Compiler Development
Introduction to Compiler Development
 
Beginner workshop to angularjs presentation at Google
Beginner workshop to angularjs presentation at GoogleBeginner workshop to angularjs presentation at Google
Beginner workshop to angularjs presentation at Google
 
Scribed lec8
Scribed lec8Scribed lec8
Scribed lec8
 
Scala as a Declarative Language
Scala as a Declarative LanguageScala as a Declarative Language
Scala as a Declarative Language
 
Home workassignment01 google docs
Home workassignment01   google docsHome workassignment01   google docs
Home workassignment01 google docs
 
DBMS CS3
DBMS CS3DBMS CS3
DBMS CS3
 
Introduction to Erlang
Introduction to ErlangIntroduction to Erlang
Introduction to Erlang
 
Groovy
GroovyGroovy
Groovy
 
Loops_in_Rv1.2b
Loops_in_Rv1.2bLoops_in_Rv1.2b
Loops_in_Rv1.2b
 
A0750105
A0750105A0750105
A0750105
 
Eta
EtaEta
Eta
 

More from Neeldhara Misra

Erdos Posa Theorem
Erdos Posa TheoremErdos Posa Theorem
Erdos Posa Theorem
Neeldhara Misra
 
15 - 12 Feb - Stable Matchings
15 - 12 Feb - Stable Matchings15 - 12 Feb - Stable Matchings
15 - 12 Feb - Stable Matchings
Neeldhara Misra
 
07- 22 Jan - Divide and Conquer
07- 22 Jan - Divide and Conquer07- 22 Jan - Divide and Conquer
07- 22 Jan - Divide and Conquer
Neeldhara Misra
 
10 - 29 Jan - Recursion Part 2
10 - 29 Jan - Recursion Part 210 - 29 Jan - Recursion Part 2
10 - 29 Jan - Recursion Part 2
Neeldhara Misra
 
05 - 18 Jan - The Sorting Wrap-Up
05 - 18 Jan - The Sorting Wrap-Up05 - 18 Jan - The Sorting Wrap-Up
05 - 18 Jan - The Sorting Wrap-Up
Neeldhara Misra
 
02 - 04 Jan - Sorting (Continued)
02 - 04 Jan - Sorting (Continued)02 - 04 Jan - Sorting (Continued)
02 - 04 Jan - Sorting (Continued)
Neeldhara Misra
 
04 - 15 Jan - Heap Sort
04 - 15 Jan - Heap Sort04 - 15 Jan - Heap Sort
04 - 15 Jan - Heap Sort
Neeldhara Misra
 
08 - 25 Jan - Divide and Conquer
08 - 25 Jan - Divide and Conquer08 - 25 Jan - Divide and Conquer
08 - 25 Jan - Divide and Conquer
Neeldhara Misra
 
06 - 20 Jan - Divide and Conquer
06 - 20 Jan - Divide and Conquer06 - 20 Jan - Divide and Conquer
06 - 20 Jan - Divide and Conquer
Neeldhara Misra
 
13 - 06 Feb - Dynamic Programming
13 - 06 Feb - Dynamic Programming13 - 06 Feb - Dynamic Programming
13 - 06 Feb - Dynamic Programming
Neeldhara Misra
 
00 - 30 Dec - Introduction
00 - 30 Dec - Introduction00 - 30 Dec - Introduction
00 - 30 Dec - Introduction
Neeldhara Misra
 
01 - 01 January - Sorting
01 - 01 January - Sorting01 - 01 January - Sorting
01 - 01 January - Sorting
Neeldhara Misra
 
11 - 03 Feb - From Recursion to Dynamic Programming
11 - 03 Feb - From Recursion to Dynamic Programming11 - 03 Feb - From Recursion to Dynamic Programming
11 - 03 Feb - From Recursion to Dynamic Programming
Neeldhara Misra
 
09 - 27 Jan - Recursion Part 1
09 - 27 Jan - Recursion Part 109 - 27 Jan - Recursion Part 1
09 - 27 Jan - Recursion Part 1
Neeldhara Misra
 
04 - 15 Jan - Heap Sort
04 - 15 Jan - Heap Sort04 - 15 Jan - Heap Sort
04 - 15 Jan - Heap Sort
Neeldhara Misra
 
12 - 05 Feb - Dynamic Programming
12 - 05 Feb - Dynamic Programming12 - 05 Feb - Dynamic Programming
12 - 05 Feb - Dynamic Programming
Neeldhara Misra
 

More from Neeldhara Misra (16)

Erdos Posa Theorem
Erdos Posa TheoremErdos Posa Theorem
Erdos Posa Theorem
 
15 - 12 Feb - Stable Matchings
15 - 12 Feb - Stable Matchings15 - 12 Feb - Stable Matchings
15 - 12 Feb - Stable Matchings
 
07- 22 Jan - Divide and Conquer
07- 22 Jan - Divide and Conquer07- 22 Jan - Divide and Conquer
07- 22 Jan - Divide and Conquer
 
10 - 29 Jan - Recursion Part 2
10 - 29 Jan - Recursion Part 210 - 29 Jan - Recursion Part 2
10 - 29 Jan - Recursion Part 2
 
05 - 18 Jan - The Sorting Wrap-Up
05 - 18 Jan - The Sorting Wrap-Up05 - 18 Jan - The Sorting Wrap-Up
05 - 18 Jan - The Sorting Wrap-Up
 
02 - 04 Jan - Sorting (Continued)
02 - 04 Jan - Sorting (Continued)02 - 04 Jan - Sorting (Continued)
02 - 04 Jan - Sorting (Continued)
 
04 - 15 Jan - Heap Sort
04 - 15 Jan - Heap Sort04 - 15 Jan - Heap Sort
04 - 15 Jan - Heap Sort
 
08 - 25 Jan - Divide and Conquer
08 - 25 Jan - Divide and Conquer08 - 25 Jan - Divide and Conquer
08 - 25 Jan - Divide and Conquer
 
06 - 20 Jan - Divide and Conquer
06 - 20 Jan - Divide and Conquer06 - 20 Jan - Divide and Conquer
06 - 20 Jan - Divide and Conquer
 
13 - 06 Feb - Dynamic Programming
13 - 06 Feb - Dynamic Programming13 - 06 Feb - Dynamic Programming
13 - 06 Feb - Dynamic Programming
 
00 - 30 Dec - Introduction
00 - 30 Dec - Introduction00 - 30 Dec - Introduction
00 - 30 Dec - Introduction
 
01 - 01 January - Sorting
01 - 01 January - Sorting01 - 01 January - Sorting
01 - 01 January - Sorting
 
11 - 03 Feb - From Recursion to Dynamic Programming
11 - 03 Feb - From Recursion to Dynamic Programming11 - 03 Feb - From Recursion to Dynamic Programming
11 - 03 Feb - From Recursion to Dynamic Programming
 
09 - 27 Jan - Recursion Part 1
09 - 27 Jan - Recursion Part 109 - 27 Jan - Recursion Part 1
09 - 27 Jan - Recursion Part 1
 
04 - 15 Jan - Heap Sort
04 - 15 Jan - Heap Sort04 - 15 Jan - Heap Sort
04 - 15 Jan - Heap Sort
 
12 - 05 Feb - Dynamic Programming
12 - 05 Feb - Dynamic Programming12 - 05 Feb - Dynamic Programming
12 - 05 Feb - Dynamic Programming
 

Recently uploaded

PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
Dr. Shivangi Singh Parihar
 
DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
taiba qazi
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
TechSoup
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
Priyankaranawat4
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
RitikBhardwaj56
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Excellence Foundation for South Sudan
 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
RAHUL
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
Priyankaranawat4
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
eBook.com.bd (প্রয়োজনীয় বাংলা বই)
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
Katrina Pritchard
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
tarandeep35
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
Celine George
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
Celine George
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
adhitya5119
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
NgcHiNguyn25
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
Scholarhat
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
amberjdewit93
 

Recently uploaded (20)

PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
 
DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
 

14 - 08 Feb - Dynamic Programming

  • 1. CS 321. Algorithm Analysis & Design Lecture 14 Dynamic Programming Edit Distance Revisited Longest Increasing Subsequence Matrix Chain Multiplication
  • 2. A L G O R I T H M A L T R U I S T I C
  • 3. A L G O R I T H M A L T R U I S T I C
  • 4. A L G O R A L T R U
  • 5. A L T R U A L G O R
  • 6. A L T R U RA L T R U Cost of converting ALGO to ALTRU + Cost of deleting R from the end
  • 7. A L G O R A L T R U
  • 8. A L G O R A L T R U
  • 9. A L T R U A L T R Cost of converting ALGOR to ALTR + Cost of inserting U at the end
  • 10. A L G O R A L T R U
  • 11. A L T R A L G O R U
  • 12. RA L T R Cost of converting ALGO to ALTR + Cost of replacing R with U A L T R U U
  • 13. To find the edit distance between ALGOR and ALTRU… or convert ALGO to ALTRU and delete R or convert ALGO to ALTR and replace R with U Either convert ALGOR to ALTR and insert U
  • 14.
  • 15. Longest Increasing Subsequence 1, 2, 3, 9, 4, 5, 10, 6, 7, 12, 13, 14, 8, 6, 17 1, 2, 3, 9, 4, 5, 10, 6, 7, 12, 13, 14, 8, 6, 17 1, 2, 3, 9, 4, 5, 10, 6, 7, 12, 13, 14, 8, 6, 17
  • 16. LIS[i] = longest increasing subsequence of the array L[1…i]. (What we want) (Build up the array bottom to top.) A = [a1, a2, … , ai, … , an] LIS[i] = max(LIS[i-1] + 1, LIS[i-1])
  • 17. LIS[i,j] = LIS of A[1…i] where all elements are at most A[j]. (What we want) (Build up the array bottom to top.) A = [a1, a2, … , ai, … , an] LIS[i,j] = LIS[i-1,j] or max(LIS[i-1,i] + 1, LIS[i-1,j])