{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

12_LongestCommonSubsequence - Wednesday Dr Daniel Hughes...

Info iconThis preview shows pages 1–13. Sign up to view the full content.

View Full Document Right Arrow Icon
CSC 30155 Wednesday 20/10/10 Dr. Daniel Hughes [email protected]
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Plan for Today Review of the LCS Problem 20 minutes A Dynamic LCS Algorithm 30 minutes LCS questions 40 minutes Feedback 10 minutes
Background image of page 2
CSC 30155 The Longest Common Subsequence Problem Dr. Daniel Hughes [email protected]
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Supporting Reading Optional reading: Cormen et al., Introduction to Algorithms , MIT Press, 2001, Chapter 15: Longest Common Subsequence Problem (15.4)
Background image of page 4
Problem Definition A subsequence of a given sequence is the given sequence with zero or more elements left out. Given two sequences: X and Y, we say that a sequence Z is a common subsequence of X and Y if Z is a subsequence of both X and Y. In the longest common subsequence problem we are given two sequences X and Y and wish to find a maximum-length common subsequence (or LCS) of both X and Y.
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Comparing to the Longest Common Substring Problem A string is a sequence of characters. However, a substring is not synonymous with a subsequence. Substrings are consecutive parts of a string, while subsequences may not be. From now on, when using the term LCS, we are referring to the Longest Common Subsequence Problem .
Background image of page 6
Example (b) is a substring and a subsequence of (a): (a) ba babc (b) babc (c) aabc (c) is a subsequence of (a) but not a substring: (a) b a b abc (b) babc (c) aabc substring subsequence
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
A Key Application: Genetic Identification (1/2) DNA may be viewed as a text written in the alphabet (A,C,G,T). Evolution occurs due to a combination of DNA mutation and natural selection. Mutations include: Point mutations : replacement of a character. Insertion mutations : addition of some characters. Deletion mutations : deletion of some characters.
Background image of page 8
A Key Application: Genetic Identification (2/2) So if we want to identify the closest genetic relative of an unknown species, we can: Take a sample of its DNA. Run LCS against known species. The one with the longest LCS is probably the closest relative.
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Why we Need and Efficient LCS Algorithm While computers grow more powerful, the quantity of information that we want to work with also grows. The Human Genome has 3 billion base pairs while the Wheat Genome has 17 billion base pairs . If we want to use LCS to identify a species of wheat, our algorithm will have to be very fast.
Background image of page 10
The Brute-Force Approach Yesterday you worked on a BRUTE-FORCE algorithm to solve this problem. The algorithm took two strings as parameters X and Y and: Enumerated all subsequences in X . Checked if each subsequence appears in Y . Returned the longest matching subsequence .
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Lets Look at the Performance of some implementations: Java implementations will be uploaded at the end of the week.
Background image of page 12
Image of page 13
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}