3102_14

3102_14 - CSC 3102 Longest Common Subsequence 1 Subsequence...

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

View Full Document Right Arrow Icon
1 CSC 3102 Longest Common Subsequence
Background image of page 1

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

View Full DocumentRight Arrow Icon
2 Subsequence of a String • Let S = s 1 s 2 …s m be a string of length m • Any string of the form s i 1 s i 2 … s i k with i 1 < i 2 < < i k is a subsequence of S • E.g., if S = farmers b fame , arm , mrs , farmers , are some of the subsequences of S
Background image of page 2
3 Longest Common Subsequence • Let S and T be two strings • If a string is both • a subsequence of S and • a subsequence of T , it is a common subsequence of S and T • In addition, if it is the longest possible one, it is a longest common subsequence
Background image of page 3

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

View Full DocumentRight Arrow Icon
4 Longest Common Subsequence • E.g., S = algorithms T = logarithms • Then, aim , lots , ohms , grit , are some of the common subsequences of S and T • Longest common subsequences: lorithms , lgrithms
Background image of page 4
5 Longest Common Subsequence • Let S = s 1 s 2 …s m be a string of length m • Let T = t 1 t 2 …t n be a string of length n Can we quickly find a longest common subsequence (LCS) of S and T ?
Background image of page 5

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

View Full DocumentRight Arrow Icon
Let X = x 1 x 2 …x k be an LCS of S 1,i = s 1 s 2 s i and T 1,j = t 1 t 2 t j . Lemma: • If s i = t j , then x k = s i = t j , and x 1 x 2 …x k-1 must be the LCS of S 1,i-1 and T 1,j-1 • If s i t j , then X must either be
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/16/2011 for the course CSC 3102 taught by Professor Kraft,d during the Fall '08 term at LSU.

Page1 / 23

3102_14 - CSC 3102 Longest Common Subsequence 1 Subsequence...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online