SlideShare a Scribd company logo
Dipta Das
LONGEST COMMON
SUBSEQUENCE
Dipta Das
SUBSEQUENCE
A subsequence of given sequence is just the given sequence with zero or
more elements left out. Example..
Dipta Das
COMMON SUBSEQUENCE
Assume Two Sequence
Sequence Z is a common subsequence of X and Y if Z is a subsequence of both X and Y
Z={ B, C, A} length-3
Z={ B, C, A, B} length-4
Z={ B, C, B} length-3
Dipta Das
LONGEST COMMON SUBSEQUENCE
Theorem
Assume:
X=(X1, X2, X3…………………Xn)
Y=(Y1, Y2, Y3…………………Yn)
Any LCS of X and Y is Z, Z=(Z1, Z2,Z3……………..Zn)
IF Then
Xi = Yj Zk=Xi=Yj implies Zk-1 LCS of Xi-1 and Yj – 1
Xi ≠ Yj Zk ≠ Xi implies Zk-1 LCS of Xi-1 and Y
Xi ≠ Yj Zk ≠ Yj implies Zk-1 LCS of Yj-1 and X
Dipta Das
To Compare DNA of two (or more ) Different organisms
Dipta Das
EXAMPLE
Assume two DNA sequence
X = {ATGCTTC}
Y = {GCTCA}
Dipta Das
LCS EXAMPLE X = {ATGCTTC}
Y = {GCTCA}
A T G C T T C
G
C
T
C
A
1 2 3 4 5 6 7
1
2
3
4
5
Yj
Xi
0
0
Dipta Das
LCS EXAMPLE
A T G C T T C
0 0 0 0 0 0 0 0
G 0
C 0
T 0
C 0
A 0
X = {ATGCTTC}
Y = {GCTCA}
1 2 3 4 5 6 7
1
2
3
4
5
Yj
Xi
0
0
Z[j,i]
Here I = 1, j = 1
Z[1,1]
Dipta Das
LCS EXAMPLE
Xi A T G C T T C
YJ 0 0 0 0 0 0 0 0
G 0
C 0
T 0
C 0
A 0
X = {ATGCTTC}
Y = {GCTCAGA}
Yj
Xi
X Y
A G
Not Match
Maximum of
two box
z[J-1, i] and
[J, i-1]
1 2 3 4 5 6 7
1
2
3
4
5
0
0
Z[1,1]
Z[j-1, i]=Z[1-1, 1]= Z[0,1]
Z[j, i-1]=Z[1, 1-1]= Z[1,0]
Dipta Das
LCS EXAMPLE
Xi A T G C T T C
YJ 0 0 0 0 0 0 0 0
G 0 0
C 0
T 0
C 0
A 0
X = {ATGCTTC}
Y = {GCTCA}
Yj
Xi
X Y
A G
Not Match
Lets Take from Upper one
Arrow indicate from
where you Take the
maximum.
1 2 3 4 5 6 7
1
2
3
4
5
0
0
Dipta Das
LCS EXAMPLE
Xi A T G C T T C
YJ 0 0 0 0 0 0 0 0
G 0 0 0
C 0
T 0
C 0
A 0
X = {ATGCTTC}
Y = {GCTCAGA}
Yj
Xi
X Y Max
T G 0
Not Match
Lets Take from left one
Arrow indicate from
where you Take the
maximum.
arrow
1 2 3 4 5 6 7
1
2
3
4
5
0
0
Dipta Das
LCS EXAMPLE
Xi A T G C T T C
YJ 0 0 0 0 0 0 0 0
G 0 0 0
C 0
T 0
C 0
A 0
X = {ATGCTTC}
Y = {GCTCAGA}
Yj
Xi
X Y Max
G G
Match
arrow
When match arrow will
be diagonal because we
will increment the
value of this cell
Z[i-1, j-1] + 10 = 1
1 2 3 4 5 6 7
1
2
3
4
5
0
0
Dipta Das
LCS EXAMPLE
Xi A T G C T T C
YJ 0 0 0 0 0 0 0 0
G 0 0 0 1
C 0
T 0
C 0
A 0
X = {ATGCTTC}
Y = {GCTCA}
Yj
Xi
X Y Max
G G
Match
arrow
Incremented value X[i-1] Y[j-1]
1 2 3 4 5 6 7
1
2
3
4
5
0
0
Z[I,j] = Z[3,1]
Dipta Das
LCS EXAMPLE
Xi A T G C T T C
YJ 0 0 0 0 0 0 0 0
G 0 0 0 1 1
C 0
T 0
C 0
A 0
X = {ATGCTTC}
Y = {ACTCAGA}
Yj
Xi
X Y Max
C G 1
Not Match
Lets Take from left one
arrow
1 2 3 4 5 6 7
1
2
3
4
5
0
0
Dipta Das
LCS EXAMPLE
Xi A T G C T T C
YJ 0 0 0 0 0 0 0 0
G 0 0 0 1 1 1
C 0
T 0
C 0
A 0
X = {ATGCTTC}
Y = {GCTCA}
Yj
Xi
X Y Max
T G 1
Not Match
Lets Take from left one
arrow
0
0
1 2 3 4 5 6 7
1
2
3
4
5
Dipta Das
LCS EXAMPLE
Xi A T G C T T C
YJ 0 0 0 0 0 0 0 0
G 0 0 0 1 1 1 1
C 0
T 0
C 0
A 0
X = {ATGCTTC}
Y = {GCTCA}
Yj
Xi
X Y Max
T G 1
Not Match
Lets Take from left one
arrow
0
0
1 2 3 4 5 6 7
1
2
3
4
5
Dipta Das
LCS EXAMPLE
Xi A T G C T T C
YJ 0 0 0 0 0 0 0 0
G 0 0 0 1 1 1 1 1
C 0
T 0
C 0
A 0
X = {ATGCTTC}
Y = {GCTCA}
Yj
Xi
X Y Max
C G 1
Not Match
Lets Take from left one
arrow
1 2 3 4 5 6 7
1
2
3
4
5
0
0
Dipta Das
LCS EXAMPLE
Xi A T G C T T C
YJ 0 0 0 0 0 0 0 0
G 0 0 0 1 1 1 1 1
C 0 0
T 0
C 0
A 0
X = {ATGCTTC}
Y = {GCTCA}
Yj
Xi
X Y Max
A C 0
Not Match
Lets Take from left one
arrow
1 2 3 4 5 6 7
1
2
3
4
5
0
0
Dipta Das
LCS EXAMPLE
Xi A T G C T T C
YJ 0 0 0 0 0 0 0 0
G 0 0 0 1 1 1 1 1
C 0 0 0
T 0
C 0
A 0
X = {ATGCTTC}
Y = {GCTCA}
Yj
Xi
X Y Max
A C 0
Not Match
Lets Take from Upper one
arrow
0
0
Dipta Das
LCS EXAMPLE
Xi A T G C T T C
YJ 0 0 0 0 0 0 0 0
G 0 0 0 1 1 1 1 1
C 0 0 0 1
T 0
C 0
A 0
X = {ATGCTTC}
Y = {GCTCA}
Yj
Xi
X Y Max
G C 1
Not Match
Lets Take from left one
arrow
1 2 3 4 5 6 7
1
2
3
4
5
0
0
Dipta Das
LCS EXAMPLE
Xi A T G C T T C
YJ 0 0 0 0 0 0 0 0
G 0 0 0 1 1 1 1 1
C 0 0 0 1 2
T 0
C 0
A 0
X = {ATGCTTC}
Y = {GCTCA}
Yj
Xi
X Y Max
C C
Match
arrow
Increment Z[i-1,j-1]
1 2 3 4 5 6 7
1
2
3
4
5
0
0
Dipta Das
LCS EXAMPLE
Xi A T G C T T C
YJ 0 0 0 0 0 0 0 0
G 0 0 0 1 1 1 1 1
C 0 0 0 1 2 2
T 0
C 0
A 0
X = {ATGCTTC}
Y = {GCTCA}
Yj
Xi
X Y Max
T C 2
Not Match
Lets Take from left one
arrow
1 2 3 4 5 6 7
1
2
3
4
5
0
0
Dipta Das
LCS EXAMPLE
Xi A T G C T T C
YJ 0 0 0 0 0 0 0 0
G 0 0 0 1 1 1 1 1
C 0 0 0 1 2 2 2 2
T 0 0 1 1 2 3 3 3
C 0 0 1 1 2 3 3 4
A 0 1 1 1 2 3 3 4
X = {ATGCTTC}
Y = {GCTCA}
Yj
Xi
X Y Max
T G 1
Not Match
Lets Take from left one
arrow
In the same way…
1 2 3 4 5 6 7
1
2
3
4
5
0
0
Dipta Das
LCS EXAMPLE
Xi A T G C T T C
YJ 0 0 0 0 0 0 0 0
G 0 0 0 1 1 1 1 1
C 0 0 0 1 2 2 2 2
T 0 0 1 1 2 3 3 3
C 0 0 1 1 2 3 3 4
A 0 1 1 1 2 3 3 4
X = {ATGCTTC}
Y = {GCTCA}
Yj
Xi
Firstly have to point out
highest value
For left and upper arrow
we will follow the
direction
For diagonal arrow we
will point out the
character for this cell.
1 2 3 4 5 6 7
1
2
3
4
5
Dipta Das
LCS EXAMPLE
Xi A T G C T T C
YJ 0 0 0 0 0 0 0 0
G 0 0 0 1 1 1 1 1
C 0 0 0 1 2 2 2 2
T 0 0 1 1 2 3 3 3
C 0 0 1 1 2 3 3 4
A 0 1 1 1 2 3 3 4
X = {ATGCTTC}
Y = {GCTCA}
Yj
Xi
LCS Z= G
1 2 3 4 5 6 7
1
2
3
4
5
Dipta Das
LCS EXAMPLE
Xi A T G C T T C
YJ 0 0 0 0 0 0 0 0
G 0 0 0 1 1 1 1 1
C 0 0 0 1 2 2 2 2
T 0 0 1 1 2 3 3 3
C 0 0 1 1 2 3 3 4
A 0 1 1 1 2 3 3 4
X = {ATGCTTC}
Y = {GCTCA}
Yj
Xi
LCS Z= GC
1 2 3 4 5 6 7
1
2
3
4
5
0
0
Dipta Das
LCS EXAMPLE
Xi A T G C T T C
YJ 0 0 0 0 0 0 0 0
G 0 0 0 1 1 1 1 1
C 0 0 0 1 2 2 2 2
T 0 0 1 1 2 3 3 3
C 0 0 1 1 2 3 3 4
A 0 1 1 1 2 3 3 4
X = {ATGCTTC}
Y = {GCTCA}
Yj
Xi
LCS Z= GCT
1 2 3 4 5 6 7
1
2
3
4
5
Dipta Das
LCS EXAMPLE
Xi A T G C T T C
YJ 0 0 0 0 0 0 0 0
G 0 0 0 1 1 1 1 1
C 0 0 0 1 2 2 2 2
T 0 0 1 1 2 3 3 3
C 0 0 1 1 2 3 3 4
A 0 1 1 1 2 3 3 4
X = {ATGCTTC}
Y = {GCTCA}
Yj
Xi
LCS Z= {GCTC}
1 2 3 4 5 6 7
1
2
3
4
5
0
0
Dipta Das
ANY QUESTION?
Dipta Das
Thank You!

More Related Content

What's hot

Tetsunao Matsuta
Tetsunao MatsutaTetsunao Matsuta
Tetsunao Matsuta
Suurist
 
Hideitsu Hino
Hideitsu HinoHideitsu Hino
Hideitsu Hino
Suurist
 
Hiroaki Shiokawa
Hiroaki ShiokawaHiroaki Shiokawa
Hiroaki Shiokawa
Suurist
 
Finite frequency H∞control design for nonlinear systems
Finite frequency H∞control design for nonlinear systemsFinite frequency H∞control design for nonlinear systems
Finite frequency H∞control design for nonlinear systems
International Journal of Power Electronics and Drive Systems
 
Solovay Kitaev theorem
Solovay Kitaev theoremSolovay Kitaev theorem
Solovay Kitaev theorem
JamesMa54
 
Integration SPM
Integration SPMIntegration SPM
Integration SPM
Hanini Hamsan
 
IIT Jam math 2016 solutions BY Trajectoryeducation
IIT Jam math 2016 solutions BY TrajectoryeducationIIT Jam math 2016 solutions BY Trajectoryeducation
IIT Jam math 2016 solutions BY Trajectoryeducation
Dev Singh
 
Solving the energy problem of helium final report
Solving the energy problem of helium final reportSolving the energy problem of helium final report
Solving the energy problem of helium final report
JamesMa54
 
Iit jam 2016 physics solutions BY Trajectoryeducation
Iit jam 2016 physics solutions BY TrajectoryeducationIit jam 2016 physics solutions BY Trajectoryeducation
Iit jam 2016 physics solutions BY Trajectoryeducation
Dev Singh
 
All pair shortest path by Sania Nisar
All pair shortest path by Sania NisarAll pair shortest path by Sania Nisar
All pair shortest path by Sania Nisar
Sania Nisar
 
Mathcad explicit solution cubic equation examples
Mathcad   explicit solution cubic equation examplesMathcad   explicit solution cubic equation examples
Mathcad explicit solution cubic equation examples
Julio Banks
 
Fast and efficient exact synthesis of single qubit unitaries generated by cli...
Fast and efficient exact synthesis of single qubit unitaries generated by cli...Fast and efficient exact synthesis of single qubit unitaries generated by cli...
Fast and efficient exact synthesis of single qubit unitaries generated by cli...
JamesMa54
 
Class 9
Class 9Class 9
Equation of second degree
Equation of second degreeEquation of second degree
Equation of second degree
M M ALAMGIR HOSSAIN
 
Capítulo 05 deflexão e rigidez
Capítulo 05   deflexão e rigidezCapítulo 05   deflexão e rigidez
Capítulo 05 deflexão e rigidez
Jhayson Carvalho
 
Math resources trigonometric_formulas
Math resources trigonometric_formulasMath resources trigonometric_formulas
Math resources trigonometric_formulas
Er Deepak Sharma
 

What's hot (16)

Tetsunao Matsuta
Tetsunao MatsutaTetsunao Matsuta
Tetsunao Matsuta
 
Hideitsu Hino
Hideitsu HinoHideitsu Hino
Hideitsu Hino
 
Hiroaki Shiokawa
Hiroaki ShiokawaHiroaki Shiokawa
Hiroaki Shiokawa
 
Finite frequency H∞control design for nonlinear systems
Finite frequency H∞control design for nonlinear systemsFinite frequency H∞control design for nonlinear systems
Finite frequency H∞control design for nonlinear systems
 
Solovay Kitaev theorem
Solovay Kitaev theoremSolovay Kitaev theorem
Solovay Kitaev theorem
 
Integration SPM
Integration SPMIntegration SPM
Integration SPM
 
IIT Jam math 2016 solutions BY Trajectoryeducation
IIT Jam math 2016 solutions BY TrajectoryeducationIIT Jam math 2016 solutions BY Trajectoryeducation
IIT Jam math 2016 solutions BY Trajectoryeducation
 
Solving the energy problem of helium final report
Solving the energy problem of helium final reportSolving the energy problem of helium final report
Solving the energy problem of helium final report
 
Iit jam 2016 physics solutions BY Trajectoryeducation
Iit jam 2016 physics solutions BY TrajectoryeducationIit jam 2016 physics solutions BY Trajectoryeducation
Iit jam 2016 physics solutions BY Trajectoryeducation
 
All pair shortest path by Sania Nisar
All pair shortest path by Sania NisarAll pair shortest path by Sania Nisar
All pair shortest path by Sania Nisar
 
Mathcad explicit solution cubic equation examples
Mathcad   explicit solution cubic equation examplesMathcad   explicit solution cubic equation examples
Mathcad explicit solution cubic equation examples
 
Fast and efficient exact synthesis of single qubit unitaries generated by cli...
Fast and efficient exact synthesis of single qubit unitaries generated by cli...Fast and efficient exact synthesis of single qubit unitaries generated by cli...
Fast and efficient exact synthesis of single qubit unitaries generated by cli...
 
Class 9
Class 9Class 9
Class 9
 
Equation of second degree
Equation of second degreeEquation of second degree
Equation of second degree
 
Capítulo 05 deflexão e rigidez
Capítulo 05   deflexão e rigidezCapítulo 05   deflexão e rigidez
Capítulo 05 deflexão e rigidez
 
Math resources trigonometric_formulas
Math resources trigonometric_formulasMath resources trigonometric_formulas
Math resources trigonometric_formulas
 

Viewers also liked

Longest Common Subsequence
Longest Common SubsequenceLongest Common Subsequence
Longest Common Subsequence
Krishma Parekh
 
Longest Common Subsequence (LCS) Algorithm
Longest Common Subsequence (LCS) AlgorithmLongest Common Subsequence (LCS) Algorithm
Longest Common Subsequence (LCS) Algorithm
Darshit Metaliya
 
Longest Common Subsequence
Longest Common SubsequenceLongest Common Subsequence
Longest Common Subsequence
Swati Swati
 
Knapsack problem
Knapsack problemKnapsack problem
Knapsack problem
Vikas Sharma
 
Knapsack
KnapsackKnapsack
Knapsack
Karthik Chetla
 

Viewers also liked (6)

Longest Common Subsequence
Longest Common SubsequenceLongest Common Subsequence
Longest Common Subsequence
 
Longest Common Subsequence (LCS) Algorithm
Longest Common Subsequence (LCS) AlgorithmLongest Common Subsequence (LCS) Algorithm
Longest Common Subsequence (LCS) Algorithm
 
Longest Common Subsequence
Longest Common SubsequenceLongest Common Subsequence
Longest Common Subsequence
 
Knapsack problem
Knapsack problemKnapsack problem
Knapsack problem
 
Knapsack
KnapsackKnapsack
Knapsack
 
Knapsack Problem
Knapsack ProblemKnapsack Problem
Knapsack Problem
 

Similar to Longest common subsequence

Chapter 31 logarithms
Chapter 31 logarithmsChapter 31 logarithms
Chapter 31 logarithms
Sarah Sue Calbio
 
Estadistica U4
Estadistica U4Estadistica U4
Estadistica U4
FacundoOrtiz18
 
AIOU Code 1429 Solved Assignment 1 Autumn 2022.pptx
AIOU Code 1429 Solved Assignment 1 Autumn 2022.pptxAIOU Code 1429 Solved Assignment 1 Autumn 2022.pptx
AIOU Code 1429 Solved Assignment 1 Autumn 2022.pptx
Zawarali786
 
Trig packet1 000
Trig packet1 000Trig packet1 000
Trig packet1 000
Mariam Bouls
 
Trig packet1 000
Trig packet1 000Trig packet1 000
Trig packet1 000
Mariam Bouls
 
lecture 5 courseII (6).pptx
lecture 5 courseII (6).pptxlecture 5 courseII (6).pptx
lecture 5 courseII (6).pptx
AYMENGOODKid
 
The Ring programming language version 1.5.3 book - Part 69 of 184
The Ring programming language version 1.5.3 book - Part 69 of 184The Ring programming language version 1.5.3 book - Part 69 of 184
The Ring programming language version 1.5.3 book - Part 69 of 184
Mahmoud Samir Fayed
 
Counting Sort and Radix Sort Algorithms
Counting Sort and Radix Sort AlgorithmsCounting Sort and Radix Sort Algorithms
Counting Sort and Radix Sort Algorithms
Sarvesh Rawat
 
The Ring programming language version 1.9 book - Part 69 of 210
The Ring programming language version 1.9 book - Part 69 of 210The Ring programming language version 1.9 book - Part 69 of 210
The Ring programming language version 1.9 book - Part 69 of 210
Mahmoud Samir Fayed
 
Graphical Method
Graphical MethodGraphical Method
Graphical MethodSachin MK
 
8-4 Tangent.ppt
8-4 Tangent.ppt8-4 Tangent.ppt
8-4 Tangent.ppt
smithj91
 
Tabel perkalian
Tabel perkalianTabel perkalian
Tabel perkalian
yanosandi
 
Application of parallel hierarchical matrices and low-rank tensors in spatial...
Application of parallel hierarchical matrices and low-rank tensors in spatial...Application of parallel hierarchical matrices and low-rank tensors in spatial...
Application of parallel hierarchical matrices and low-rank tensors in spatial...
Alexander Litvinenko
 
8-1 Geometric Mean.ppt
8-1 Geometric Mean.ppt8-1 Geometric Mean.ppt
8-1 Geometric Mean.ppt
smithj91
 
Formulario derivadas e integrales
Formulario derivadas e integralesFormulario derivadas e integrales
Formulario derivadas e integralesGeovanny Jiménez
 
Formulario
FormularioFormulario
Formulario
Jonnathan Cespedes
 
Formulario
FormularioFormulario
Formulario
Genaro Coronel
 
Formulario calculo
Formulario calculoFormulario calculo
Formulario calculo
Javier Culebro Ara
 
Formulas de calculo
Formulas de calculoFormulas de calculo
Formulas de calculo
Jose Alejandro
 

Similar to Longest common subsequence (20)

Chapter 31 logarithms
Chapter 31 logarithmsChapter 31 logarithms
Chapter 31 logarithms
 
Estadistica U4
Estadistica U4Estadistica U4
Estadistica U4
 
AIOU Code 1429 Solved Assignment 1 Autumn 2022.pptx
AIOU Code 1429 Solved Assignment 1 Autumn 2022.pptxAIOU Code 1429 Solved Assignment 1 Autumn 2022.pptx
AIOU Code 1429 Solved Assignment 1 Autumn 2022.pptx
 
Trig packet1 000
Trig packet1 000Trig packet1 000
Trig packet1 000
 
Trig packet1 000
Trig packet1 000Trig packet1 000
Trig packet1 000
 
lecture 5 courseII (6).pptx
lecture 5 courseII (6).pptxlecture 5 courseII (6).pptx
lecture 5 courseII (6).pptx
 
The Ring programming language version 1.5.3 book - Part 69 of 184
The Ring programming language version 1.5.3 book - Part 69 of 184The Ring programming language version 1.5.3 book - Part 69 of 184
The Ring programming language version 1.5.3 book - Part 69 of 184
 
Counting Sort and Radix Sort Algorithms
Counting Sort and Radix Sort AlgorithmsCounting Sort and Radix Sort Algorithms
Counting Sort and Radix Sort Algorithms
 
The Ring programming language version 1.9 book - Part 69 of 210
The Ring programming language version 1.9 book - Part 69 of 210The Ring programming language version 1.9 book - Part 69 of 210
The Ring programming language version 1.9 book - Part 69 of 210
 
VALIDITAS NILAI TES
VALIDITAS NILAI TESVALIDITAS NILAI TES
VALIDITAS NILAI TES
 
Graphical Method
Graphical MethodGraphical Method
Graphical Method
 
8-4 Tangent.ppt
8-4 Tangent.ppt8-4 Tangent.ppt
8-4 Tangent.ppt
 
Tabel perkalian
Tabel perkalianTabel perkalian
Tabel perkalian
 
Application of parallel hierarchical matrices and low-rank tensors in spatial...
Application of parallel hierarchical matrices and low-rank tensors in spatial...Application of parallel hierarchical matrices and low-rank tensors in spatial...
Application of parallel hierarchical matrices and low-rank tensors in spatial...
 
8-1 Geometric Mean.ppt
8-1 Geometric Mean.ppt8-1 Geometric Mean.ppt
8-1 Geometric Mean.ppt
 
Formulario derivadas e integrales
Formulario derivadas e integralesFormulario derivadas e integrales
Formulario derivadas e integrales
 
Formulario
FormularioFormulario
Formulario
 
Formulario
FormularioFormulario
Formulario
 
Formulario calculo
Formulario calculoFormulario calculo
Formulario calculo
 
Formulas de calculo
Formulas de calculoFormulas de calculo
Formulas de calculo
 

Recently uploaded

Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
Jen Stirrup
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..
UiPathCommunity
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
RinaMondal9
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
Vlad Stirbu
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
nkrafacyberclub
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 

Recently uploaded (20)

Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 

Longest common subsequence

  • 2. Dipta Das SUBSEQUENCE A subsequence of given sequence is just the given sequence with zero or more elements left out. Example..
  • 3. Dipta Das COMMON SUBSEQUENCE Assume Two Sequence Sequence Z is a common subsequence of X and Y if Z is a subsequence of both X and Y Z={ B, C, A} length-3 Z={ B, C, A, B} length-4 Z={ B, C, B} length-3
  • 4. Dipta Das LONGEST COMMON SUBSEQUENCE Theorem Assume: X=(X1, X2, X3…………………Xn) Y=(Y1, Y2, Y3…………………Yn) Any LCS of X and Y is Z, Z=(Z1, Z2,Z3……………..Zn) IF Then Xi = Yj Zk=Xi=Yj implies Zk-1 LCS of Xi-1 and Yj – 1 Xi ≠ Yj Zk ≠ Xi implies Zk-1 LCS of Xi-1 and Y Xi ≠ Yj Zk ≠ Yj implies Zk-1 LCS of Yj-1 and X
  • 5. Dipta Das To Compare DNA of two (or more ) Different organisms
  • 6. Dipta Das EXAMPLE Assume two DNA sequence X = {ATGCTTC} Y = {GCTCA}
  • 7. Dipta Das LCS EXAMPLE X = {ATGCTTC} Y = {GCTCA} A T G C T T C G C T C A 1 2 3 4 5 6 7 1 2 3 4 5 Yj Xi 0 0
  • 8. Dipta Das LCS EXAMPLE A T G C T T C 0 0 0 0 0 0 0 0 G 0 C 0 T 0 C 0 A 0 X = {ATGCTTC} Y = {GCTCA} 1 2 3 4 5 6 7 1 2 3 4 5 Yj Xi 0 0 Z[j,i] Here I = 1, j = 1 Z[1,1]
  • 9. Dipta Das LCS EXAMPLE Xi A T G C T T C YJ 0 0 0 0 0 0 0 0 G 0 C 0 T 0 C 0 A 0 X = {ATGCTTC} Y = {GCTCAGA} Yj Xi X Y A G Not Match Maximum of two box z[J-1, i] and [J, i-1] 1 2 3 4 5 6 7 1 2 3 4 5 0 0 Z[1,1] Z[j-1, i]=Z[1-1, 1]= Z[0,1] Z[j, i-1]=Z[1, 1-1]= Z[1,0]
  • 10. Dipta Das LCS EXAMPLE Xi A T G C T T C YJ 0 0 0 0 0 0 0 0 G 0 0 C 0 T 0 C 0 A 0 X = {ATGCTTC} Y = {GCTCA} Yj Xi X Y A G Not Match Lets Take from Upper one Arrow indicate from where you Take the maximum. 1 2 3 4 5 6 7 1 2 3 4 5 0 0
  • 11. Dipta Das LCS EXAMPLE Xi A T G C T T C YJ 0 0 0 0 0 0 0 0 G 0 0 0 C 0 T 0 C 0 A 0 X = {ATGCTTC} Y = {GCTCAGA} Yj Xi X Y Max T G 0 Not Match Lets Take from left one Arrow indicate from where you Take the maximum. arrow 1 2 3 4 5 6 7 1 2 3 4 5 0 0
  • 12. Dipta Das LCS EXAMPLE Xi A T G C T T C YJ 0 0 0 0 0 0 0 0 G 0 0 0 C 0 T 0 C 0 A 0 X = {ATGCTTC} Y = {GCTCAGA} Yj Xi X Y Max G G Match arrow When match arrow will be diagonal because we will increment the value of this cell Z[i-1, j-1] + 10 = 1 1 2 3 4 5 6 7 1 2 3 4 5 0 0
  • 13. Dipta Das LCS EXAMPLE Xi A T G C T T C YJ 0 0 0 0 0 0 0 0 G 0 0 0 1 C 0 T 0 C 0 A 0 X = {ATGCTTC} Y = {GCTCA} Yj Xi X Y Max G G Match arrow Incremented value X[i-1] Y[j-1] 1 2 3 4 5 6 7 1 2 3 4 5 0 0 Z[I,j] = Z[3,1]
  • 14. Dipta Das LCS EXAMPLE Xi A T G C T T C YJ 0 0 0 0 0 0 0 0 G 0 0 0 1 1 C 0 T 0 C 0 A 0 X = {ATGCTTC} Y = {ACTCAGA} Yj Xi X Y Max C G 1 Not Match Lets Take from left one arrow 1 2 3 4 5 6 7 1 2 3 4 5 0 0
  • 15. Dipta Das LCS EXAMPLE Xi A T G C T T C YJ 0 0 0 0 0 0 0 0 G 0 0 0 1 1 1 C 0 T 0 C 0 A 0 X = {ATGCTTC} Y = {GCTCA} Yj Xi X Y Max T G 1 Not Match Lets Take from left one arrow 0 0 1 2 3 4 5 6 7 1 2 3 4 5
  • 16. Dipta Das LCS EXAMPLE Xi A T G C T T C YJ 0 0 0 0 0 0 0 0 G 0 0 0 1 1 1 1 C 0 T 0 C 0 A 0 X = {ATGCTTC} Y = {GCTCA} Yj Xi X Y Max T G 1 Not Match Lets Take from left one arrow 0 0 1 2 3 4 5 6 7 1 2 3 4 5
  • 17. Dipta Das LCS EXAMPLE Xi A T G C T T C YJ 0 0 0 0 0 0 0 0 G 0 0 0 1 1 1 1 1 C 0 T 0 C 0 A 0 X = {ATGCTTC} Y = {GCTCA} Yj Xi X Y Max C G 1 Not Match Lets Take from left one arrow 1 2 3 4 5 6 7 1 2 3 4 5 0 0
  • 18. Dipta Das LCS EXAMPLE Xi A T G C T T C YJ 0 0 0 0 0 0 0 0 G 0 0 0 1 1 1 1 1 C 0 0 T 0 C 0 A 0 X = {ATGCTTC} Y = {GCTCA} Yj Xi X Y Max A C 0 Not Match Lets Take from left one arrow 1 2 3 4 5 6 7 1 2 3 4 5 0 0
  • 19. Dipta Das LCS EXAMPLE Xi A T G C T T C YJ 0 0 0 0 0 0 0 0 G 0 0 0 1 1 1 1 1 C 0 0 0 T 0 C 0 A 0 X = {ATGCTTC} Y = {GCTCA} Yj Xi X Y Max A C 0 Not Match Lets Take from Upper one arrow 0 0
  • 20. Dipta Das LCS EXAMPLE Xi A T G C T T C YJ 0 0 0 0 0 0 0 0 G 0 0 0 1 1 1 1 1 C 0 0 0 1 T 0 C 0 A 0 X = {ATGCTTC} Y = {GCTCA} Yj Xi X Y Max G C 1 Not Match Lets Take from left one arrow 1 2 3 4 5 6 7 1 2 3 4 5 0 0
  • 21. Dipta Das LCS EXAMPLE Xi A T G C T T C YJ 0 0 0 0 0 0 0 0 G 0 0 0 1 1 1 1 1 C 0 0 0 1 2 T 0 C 0 A 0 X = {ATGCTTC} Y = {GCTCA} Yj Xi X Y Max C C Match arrow Increment Z[i-1,j-1] 1 2 3 4 5 6 7 1 2 3 4 5 0 0
  • 22. Dipta Das LCS EXAMPLE Xi A T G C T T C YJ 0 0 0 0 0 0 0 0 G 0 0 0 1 1 1 1 1 C 0 0 0 1 2 2 T 0 C 0 A 0 X = {ATGCTTC} Y = {GCTCA} Yj Xi X Y Max T C 2 Not Match Lets Take from left one arrow 1 2 3 4 5 6 7 1 2 3 4 5 0 0
  • 23. Dipta Das LCS EXAMPLE Xi A T G C T T C YJ 0 0 0 0 0 0 0 0 G 0 0 0 1 1 1 1 1 C 0 0 0 1 2 2 2 2 T 0 0 1 1 2 3 3 3 C 0 0 1 1 2 3 3 4 A 0 1 1 1 2 3 3 4 X = {ATGCTTC} Y = {GCTCA} Yj Xi X Y Max T G 1 Not Match Lets Take from left one arrow In the same way… 1 2 3 4 5 6 7 1 2 3 4 5 0 0
  • 24. Dipta Das LCS EXAMPLE Xi A T G C T T C YJ 0 0 0 0 0 0 0 0 G 0 0 0 1 1 1 1 1 C 0 0 0 1 2 2 2 2 T 0 0 1 1 2 3 3 3 C 0 0 1 1 2 3 3 4 A 0 1 1 1 2 3 3 4 X = {ATGCTTC} Y = {GCTCA} Yj Xi Firstly have to point out highest value For left and upper arrow we will follow the direction For diagonal arrow we will point out the character for this cell. 1 2 3 4 5 6 7 1 2 3 4 5
  • 25. Dipta Das LCS EXAMPLE Xi A T G C T T C YJ 0 0 0 0 0 0 0 0 G 0 0 0 1 1 1 1 1 C 0 0 0 1 2 2 2 2 T 0 0 1 1 2 3 3 3 C 0 0 1 1 2 3 3 4 A 0 1 1 1 2 3 3 4 X = {ATGCTTC} Y = {GCTCA} Yj Xi LCS Z= G 1 2 3 4 5 6 7 1 2 3 4 5
  • 26. Dipta Das LCS EXAMPLE Xi A T G C T T C YJ 0 0 0 0 0 0 0 0 G 0 0 0 1 1 1 1 1 C 0 0 0 1 2 2 2 2 T 0 0 1 1 2 3 3 3 C 0 0 1 1 2 3 3 4 A 0 1 1 1 2 3 3 4 X = {ATGCTTC} Y = {GCTCA} Yj Xi LCS Z= GC 1 2 3 4 5 6 7 1 2 3 4 5 0 0
  • 27. Dipta Das LCS EXAMPLE Xi A T G C T T C YJ 0 0 0 0 0 0 0 0 G 0 0 0 1 1 1 1 1 C 0 0 0 1 2 2 2 2 T 0 0 1 1 2 3 3 3 C 0 0 1 1 2 3 3 4 A 0 1 1 1 2 3 3 4 X = {ATGCTTC} Y = {GCTCA} Yj Xi LCS Z= GCT 1 2 3 4 5 6 7 1 2 3 4 5
  • 28. Dipta Das LCS EXAMPLE Xi A T G C T T C YJ 0 0 0 0 0 0 0 0 G 0 0 0 1 1 1 1 1 C 0 0 0 1 2 2 2 2 T 0 0 1 1 2 3 3 3 C 0 0 1 1 2 3 3 4 A 0 1 1 1 2 3 3 4 X = {ATGCTTC} Y = {GCTCA} Yj Xi LCS Z= {GCTC} 1 2 3 4 5 6 7 1 2 3 4 5 0 0