longest common Subsequence
what is algorithm?
• An algorithm is a step-by-step procedure or set of instructions for
solving a specific problem or performing a particular task.
• help us make better choices.
• they're used not only in computing but also in everyday activities
what is
LCS?
Given two sequences, often denoted as "X" and "Y,"
Longest Common Subsequence is a new sequence that
the
contains elements found in both sequences in the same
order. It doesn't require contiguous elements, which
distinguishes it from the "Longest Common Substring."
it means that the elements in the common subsequence
don't have to be next to each other in the original
sequences. They can be spread out with other elements in
between, as long as they maintain the same order.
Meaning finding common
patterns in sequences, such
as strings
Apple Maple
LCS=APL
E
House Mouse
LCS=OUS
Why dynamic
programming for
LCS problem ?
Instead of
recursion
In recursion In dynamic
programing
Time taken or Time taken or
No of times No of times
Function called Function called =m*n
=2^n
consider two strings x[i],y[J]x[i]={ABCD} ,y[j]={BDE}
by retracing the
path of the last
element
we get “BD ” as lcs
if(x[i]=y[J])
{lcs[i,J]=1+lcs[i-1,J-1];}
else {
lcs[i,J]=max(lcs[i-1,J], lcs[i,J-
1]);}
1: SPELL CHECKERS: LCS Can Be Used To Suggest
Corrections In Spelling Or Grammar Checks By
Identifying The Longest Common Subsequence Between
A Misspelled Word And A Dictionary Word
2: Data Deduplication: In Data Storage And Backup
Systems, LCS Can Be Used To Identify Duplicate Data
Chunks, Reducing Storage Space And Improving Data
Management
3:Software Engineering: LCS can be used in
software engineering for identifying code
similarities and code cloning, which can be helpful
for maintenance and refactoring tasks
4:Computer Vision: LCS can be applied to compare
and match image sequences for tasks like video
analysis, object tracking, and motion detection..
5:Song Comparison and Recognition: In music analysis
and recognition, It can help identify similarities
between songs, making it possible to build
recommendation systems or identify copyrighted
content.
6:Genetic Analysis: In genetics, LCS is used to
compare DNA sequences and identify conserved
regions across different species, which can help in
understanding evolutionary relationships.
7:Bioinformatics: In bioinformatics, LCS is used to compare
DNA and protein sequences. It helps identify common genetic
features or structural similarities in biological sequences. It is
used in tasks like sequence alignment and similarity
searching.
8:Plagiarism Detection: LCS can be employed to detect
instances of plagiarism in written content. By finding the
longest common subsequence between a suspicious
document and known sources, you can identify copied or
paraphrased text.
THANK YOU