110 likes | 384 Views
Longest Common Subsequence. Chris Carpenter Charles Cobb Lance Hymel. Problem. Given two strings, find the longest subsequences (LCS) shared by both strings. Dynamic Programming Solution. Construct a n 1 ×n 2 table Fill in table Top-left to bottom-right
E N D
Longest Common Subsequence Chris Carpenter Charles Cobb Lance Hymel
Problem • Given two strings, find the longest subsequences (LCS) shared by both strings.
Dynamic Programming Solution • Construct a n1×n2 table • Fill in table • Top-left to bottom-right • Increment whenever match is found • Bottom-right number is length of LCS • Scan table bottom-right to top-left • Locations where number decreases diagonally are included in LCS
Hirschberg Solution (cont) • Recursively scan • Still runs in linear time • Uses O(min(string1, string2)) memory
Real-World Implementations • File comparison • Source-code control • Insertion, Deletion, Merging • Bioinformatics • Sequence analysis • Comparative genomics
Bioinformatics • Sequence analysis is the process of subjecting a DNA, RNA or peptide sequence to any of a wide range of analytical methods • The analytical methods include : • Sequence Alignment • Methodical biological database searches