in reply to True Brute Force Longest Common Sub Sequence
If I understand your question correctly, you want to know how many subsequences are in a given sequence? So for a S1="abcde" you can have subsequences of a,ab,abc,abcd,abcde,b,bc,bcd,bcde,c,cd,cde,d,de,e. Is that right?
Then it's a straight function of length. Because a subsequence can start on any letter and run from between 1 character until the rest of the length long.
In the previous example the sequence is 5 long. And there are 5 subsequences beginning with a. There are 4 subsequences starting with b. 3 with c and so on. Number of subsequences: 5 + 4 + 3 + 2 + 1
So the number of subsequences is the sum from 1 to length. 1 + 2 + 3 + . . . + lengthOfString = # of subsequences.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: True Brute Force Longest Common Sub Sequence
by Anonymous Monk on Nov 25, 2007 at 06:51 UTC | |
by roboticus (Chancellor) on Nov 25, 2007 at 12:58 UTC | |
by CountZero (Bishop) on Nov 25, 2007 at 10:28 UTC | |
by BrowserUk (Patriarch) on Nov 25, 2007 at 11:04 UTC | |
by CountZero (Bishop) on Nov 25, 2007 at 13:24 UTC | |
by KurtSchwind (Chaplain) on Nov 25, 2007 at 13:13 UTC |