Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Longest Common Subsequence Question

by ikegami (Patriarch)
on Nov 19, 2007 at 03:57 UTC ( [id://651578]=note: print w/replies, xml ) Need Help??


in reply to Longest Common Subsequence Question

Your method would fail for

S1 = aabbb S2 = aabbb S3 = aa

The answer is "aa", but your method will try to find the LCS("bbb", "aa") and will fail to find a result.

Update: Oops, I meant

S1 = aa1bbb S2 = aa2bbb S3 = aa

Replies are listed 'Best First'.
Re^2: Longest Common Subsequence Question
by Anonymous Monk on Nov 19, 2007 at 04:11 UTC
    I thought the longest common subsequence between S1 and S2 in this case is aabbb.
    And then the longest common subsequence between this result aabbb and S3 (aa) is aa. Am I missing something?

      Oops, I meant

      S1 = aa1bbb S2 = aa2bbb S3 = aa
        with S1=aa1bbb and S2=aa2bbb the longest common subsequence between them still would be aabbb and the longest common subsequence between aabbb and aa would still be aa. This is the longest common subsequence, not the longest common substring.
        Thank you all. This one got me thinking for awhile there.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://651578]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (4)
As of 2024-04-24 18:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found