<html>

<head><script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- MyFirstUnitAd -->
<ins class="adsbygoogle"
     style="display:inline-block;width:970px;height:250px"
     data-ad-client="ca-pub-5778386704669218"
     data-ad-slot="1503492166"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>

<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Longest Common Subsequence</title>
</head>

<body>



<p align="left"><font size="6" color="#FF0000"><span lang="en-ca"><b>&nbsp; 
 
</b></span><b>&nbsp;&nbsp;&nbsp; </b></font><span lang="en-ca">
<font size="6" color="#FF0000"><b>Longest Common Subsequence(experiment)</b></font></span></p>

<div align="left">
  <pre><b><font color="#ff0000" size="5">A. <span lang="en-ca">Second </span>Edition</font></b></pre>
</div>
<div align="left">
  <pre><b><span lang="en-ca">I am using the LCS to do a series meaningless little experiments. </span></b></pre>
</div>
<div align="left">
  <pre><b><font color="#ff0000" size="5"><span lang="en-ca">B</span>.<span lang="en-ca"><a name="problem"></a>The problem</span></font></b></pre>
</div>
<p ALIGN="LEFT"><span lang="en-ca"><font size="2"><b>1. How to find common 
sub-sequence among strings of more than two?</b></font></span></p>
<p ALIGN="LEFT"><span lang="en-ca"><font size="2"><b>2. What is the relationship 
between common sub-sequence and its parental sequences? If represented by 
decimal </b></font></span></p>
<p ALIGN="LEFT"><span lang="en-ca"><font size="2"><b>integer, can you recognize 
the fathers from their son?</b></font></span></p>
<div align="left">
  <b><font color="#ff0000" size="5"><span lang="en-ca"><a name="explain"></a>C</span>.<span lang="en-ca">The
  </span></font></b><span lang="en-ca"><font size="5" color="#FF0000"><b>idea of 
  program</b></font></span></div>
<div align="left">
  กก</div>
<p ALIGN="LEFT"><span lang="en-ca"><font size="2"><b>1. How to find common 
sub-sequence among strings of more than two?</b></font></span></p>
<p ALIGN="LEFT"><span lang="en-ca"><font size="2"><b>I started with three 
strings and it turned out to be meaningless since different sequences lead to 
different</b></font></span></p>
<p ALIGN="LEFT"><span lang="en-ca"><font size="2"><b>results. I then tried to 
increase the number of sequences to five. Then I need a little 
&quot;permutation-generator&quot;</b></font></span></p>
<p ALIGN="LEFT"><span lang="en-ca"><font size="2"><b>to generate all permutation 
of sequences. Here I used the recursive function &quot;permute&quot; which needs a 
function </b></font></span></p>
<p ALIGN="LEFT"><span lang="en-ca"><font size="2"><b>pointer which will use that 
sequences generated by &quot;permute&quot; function. It sounds a bit bizarre, but I cannot
</b></font></span></p>
<p ALIGN="LEFT"><span lang="en-ca"><font size="2"><b>find a better solution 
since I hate to ask user to make repeated calls to permute unless it return some 
stopping</b></font></span></p>
<p ALIGN="LEFT"><span lang="en-ca"><font size="2"><b>signal (i.e. strtok?).</b></font></span></p>
<p ALIGN="LEFT"><span lang="en-ca"><font size="2"><b>2. What is the relationship 
between common sub-sequence and its parental sequences? If represented by 
decimal </b></font></span></p>
<p ALIGN="LEFT"><span lang="en-ca"><font size="2"><b>integer, can you recognize 
the fathers from their son?</b></font></span></p>
<p ALIGN="LEFT"><span lang="en-ca"><font size="2"><b>This is like a little joke 
because how come there is any relationship between decimal and binary 
representation</b></font></span></p>
<p ALIGN="LEFT"><span lang="en-ca"><font size="2"><b>of sequences of &quot;0&quot; and 
&quot;1&quot;. However, it is a little surprise for me to try to change binary into 
decimal. </b></font></span></p>
<p ALIGN="LEFT"><span lang="en-ca"><font size="2"><b>Frankly speaking, I tried 
more than a couple ways. It is too easy, uh? Still you need to do it to discover</b></font></span></p>
<p ALIGN="LEFT"><span lang="en-ca"><font size="2"><b>something you haven't 
imagined.</b></font></span></p>
<div align="left">
  <pre><b><font color="#ff0000" size="5">D.<span lang="en-ca"><a name="Method"></a>The </span>major functions</font></b></pre>
</div>
<div align="left">
  <pre>กก</pre>
</div>
<div align="left">
  <pre><b><font color="#ff0000" size="5"><span lang="en-ca">E</span>.</font></b><span lang="en-ca"><font size="5" color="#FF0000"><b>Further improvement</b></font></span></pre>
</div>
<div align="left">
  <pre>กก</pre>
</div>
<div align="left">
  <pre><b><font color="#ff0000" size="5"><span lang="en-ca">F</span>.</font></b><span lang="en-ca"><font size="5" color="#FF0000"><b>File listing</b></font></span></pre>
</div>
<div align="left">
  <pre><font size="3"><b>1<span lang="en-ca">. LCS.h</span></b></font></pre>
</div>
<div align="left">
  <pre><font size="3"><b><span lang="en-ca">2. LCS.cpp</span></b></font></pre>
</div>
<div align="left">
  <pre><font size="3"><b><span lang="en-ca">3. main.cpp</span></b></font></pre>
</div>
<div align="left">
  <pre><span lang="en-ca"><font size="3" color="#FF0000"><b>file name: LCS.h</b></font></span></pre>
</div>
<pre>
class LCS
{
private:
	int** matrix;
	char* rowStr;
	char* colStr;
	int row, col;
	int curRow, curCol;
	void initialize(char* str1, char* str2);
	void diffCase(int r, int c);
	void sameCase(int r, int c);
	void printMatrix();
	void uninitialize();
public:
	char* stack;
	int compStr(const char* str1, const char* str2);
	void print(bool showMatrix=false);
	LCS();
	bool isSubstr(char* father, char* son);
	~LCS();
};</pre>
<pre>กก</pre>
<pre><span lang="en-ca"><font size="3" color="#FF0000"><b>file name: LCS.cpp</b></font></span></pre>
<pre>#include &lt;stdlib.h&gt;
#include &lt;stdio.h&gt;
#include &lt;string.h&gt;
#include &quot;LCS.H&quot;


bool LCS::isSubstr(char* father, char* son)
{
	char* pFather=father, * pSon=son;
	while (*pSon!='\0')
	{
		if (*pFather=='\0')
		{
			return false;
		}
		if (*pFather==*pSon)
		{
			pFather++;
			pSon++;
		}
		else
		{
			pFather++;
		}
	}
	return true;
}

LCS::~LCS()
{
	uninitialize();
}

void LCS::uninitialize()
{
	if (matrix!=NULL)
	{
		for (int i=0; i&lt;row; i++)
		{
			delete [] matrix[i];
		}
		delete [] matrix;
		matrix=NULL;
	}
	if (stack!=NULL)
	{
		delete [] stack;
	}
	stack=NULL;
}

LCS::LCS()
{
	matrix=NULL;
	rowStr=colStr=stack=NULL;
	curRow=curCol=0;
}


void LCS::initialize(char* str1, char* str2)
{
	uninitialize();
	row=strlen(str1);
	col=strlen(str2);
	rowStr=(char*)str1;
	colStr=(char*)str2;
	matrix=new int*[row];
	for (int i=0; i&lt;row; i++)
	{
		matrix[i]=new int[col];
		for (int j=0; j&lt;col; j++)
		{
			//because every row by default has maximum of this number
			matrix[i][j]=i+1;
		}
	}
}

int LCS::compStr(const char* str1, const char* str2)
{
	initialize((char*)str1, (char*)str2);
	for (int r=0; r&lt;row; r++)
	{
		for (int c=0; c&lt;col; c++)
		{
			if (str1[r]!=str2[c])
			{
				diffCase(r, c);				
			}
			else
			{
				sameCase(r, c);
			}
			//if exceeds the limit, no need for further 
			if (matrix[r][c]==r+1)
			{
				break;
			}
		}
	}
	return matrix[row-1][col-1];
}

void LCS::printMatrix()
{
	for (int r=0; r&lt;col; r++)
	{
		printf(&quot;%2d  &quot;, r+1);
	}
	printf(&quot;\n&quot;);
	for ( r=0; r&lt;row; r++)
	{
		for (int c=0; c&lt;col; c++)
		{
			printf(&quot;%2d  &quot;, matrix[r][c]);
		}
		printf(&quot;\n&quot;);
	}
}


void LCS::print(bool showMatrix)
{
	int r=row-1, c=col-1, len=matrix[row-1][col-1];
	stack=new char[len+1];
	stack[len]='\0';
	if (showMatrix)
	{
		printMatrix();
	}
	printf(&quot;str1=%s\nstr2=%s\n&quot;, rowStr, colStr);

	while (r!=0&amp;&amp;c!=0)
	{
		if (matrix[r][c]==matrix[r-1][c])
		{			
			r--;			
		}
		else
		{
			if (matrix[r][c]==matrix[r][c-1])
			{
				c--;
			}
			else
			{
				//it must be same for the last one
				stack[--len]=rowStr[r];
				r--;
				c--;
			}
		}
	}
	if (len&gt;0)
	{
		stack[--len]=rowStr[r];
	}
	printf(&quot;the common subsequence is:%s\n&quot;, stack);
}

void LCS::sameCase(int r, int c)
{
	if (r!=0&amp;&amp;c!=0)
	{
		matrix[r][c]=matrix[r-1][c-1]+1;
	}
	else
	{
		matrix[r][c]=1;
	}
}

void LCS::diffCase(int r, int c)
{
	if (r!=0&amp;&amp;c!=0)
	{
		if (matrix[r][c-1]&gt;matrix[r-1][c])
		{
			matrix[r][c]=matrix[r][c-1];
		}
		else
		{
			matrix[r][c]=matrix[r-1][c];
		}
	}
	else
	{
		matrix[r][c]=0;
	}
}




</pre>
<pre>
</pre>
<pre><span lang="en-ca"><font size="3" color="#FF0000"><b>file name: main.cpp</b></font></span></pre>
<pre>#include &quot;LCS.H&quot;
#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;string.h&gt;
#include &lt;time.h&gt;

const int MaxStringLength=10;
const int MaxStringNumbers=5;
/*
char* str1=&quot;010010100100111100&quot;;
char* str2=&quot;10001111010010101001001&quot;;
char* str3=&quot;010100101001011010&quot;;

char* str1=&quot;010010100&quot;;
char* str2=&quot;1000111101&quot;;
char* str3=&quot;010101101&quot;;
*/

char strings[MaxStringNumbers][MaxStringLength+1];

void genStr();
void permute(int num1, int num2, int num3);
int binary(char* str);

LCS L;

int sequence[MaxStringNumbers];

void permute(int index, void (*user)(int seq[]));

void compThree();
void compTwo(int seq[]);


int main()
{
	srand(time(0));
	for (int i=0; i&lt;MaxStringNumbers; i++)
	{
		sequence[i]=i;
	}
	genStr();

	compTwo(sequence);

	permute(0, compTwo);
	//printf(&quot;%d\n&quot;, binary(&quot;011001&quot;));

/*
	printf(&quot;The length is %d\n&quot;, L.compStr(str1, str2));
	L.print();
	strcpy(buffer, L.stack);
	printf(&quot;The length is %d\n&quot;, L.compStr(buffer, str3));
	printf(&quot;str1^str2^str3:\n&quot;);
	L.print();
	printf(&quot;\n&quot;);
	printf(&quot;The length is %d\n&quot;, L.compStr(str1, str3));
	L.print();
	strcpy(buffer, L.stack);
	printf(&quot;The length is %d\n&quot;, L.compStr(buffer, str2));
	printf(&quot;str1^str3^str2:\n&quot;);
	L.print();
	printf(&quot;\n&quot;);
	printf(&quot;The length is %d\n&quot;, L.compStr(str2, str3));
	L.print();
	strcpy(buffer, L.stack);
	printf(&quot;The length is %d\n&quot;, L.compStr(buffer, str1));
	printf(&quot;str2^str3^str1:\n&quot;);
	L.print();
	printf(&quot;\n&quot;);
*/
	return 0;
}

int binary(char* str)
{
	char* ptr=str;
	int result=0;
	while (true)
	{
		if (*ptr=='1')
		{
			result+=1;
		}
		ptr++;
		if (*ptr=='\0')
		{
			break;
		}
		result=result&lt;&lt;1;
	}
		

	return result;
}

void swap(int i, int j)
{
	int temp;
	temp=sequence[i];
	sequence[i]=sequence[j];
	sequence[j]=temp;
}

void permute(int index,  void (*user)(int seq[]))
{
	void swap(int i, int j);

	if (index==MaxStringNumbers-1)
	{
		return;
	}

	for (int i=index+1; i&lt;MaxStringNumbers; i++)
	{
			swap(i, index);
			user(sequence);
			permute(index+1, user);
			swap(i, index);//back
	
	}
}






void compTwo(int seq[])
{
	char buffer[MaxStringLength+1];
	strcpy(buffer, strings[seq[0]]);
	for (int i=1; i&lt;MaxStringNumbers; i++)
	{
		printf(&quot;The length is %d\n&quot;, L.compStr(buffer, strings[seq[i]]));
		L.print();
		strcpy(buffer, L.stack);
		//printf(&quot;str1=%d\nstr2=%d\nsubstr=%d\n&quot;, binary(strings[seq[i]]), binary(strings[seq[i+1]]),
		//binary(L.stack));
	}
	printf(&quot;the sequence is:\n&quot;);
	for (i=0; i&lt;MaxStringNumbers; i++)
	{
		printf(&quot;seq[%d]=%d;&quot;, i, seq[i]);
	}
	printf(&quot;\n&quot;);
}

void compThree()
{
	genStr();
	permute(0,1,2);
	permute(1,2,0);
	permute(2,0,1);
}


void permute(int num1, int num2, int num3)
{
	char buffer[30];
	
	printf(&quot;sequence of %d--&gt;%d--&gt;%d\n&quot;, num1, num2, num3);
	printf(&quot;The length is %d\n&quot;, L.compStr(strings[num1], strings[num2]));
	L.print();
	strcpy(buffer, L.stack);
	printf(&quot;The length is %d\n&quot;, L.compStr(buffer, strings[num3]));
	L.print();

	if (!L.isSubstr(strings[num1], L.stack))
	{
		printf(&quot;%s is not common substring of str%d\n&quot;, L.stack, num1);
	}
	if (!L.isSubstr(strings[num2], L.stack))
	{
		printf(&quot;%s is not common substring of str%d\n&quot;, L.stack, num2);
	}

	if (!L.isSubstr(strings[num3], L.stack))
	{
		printf(&quot;%s is not common substring of str%d\n&quot;, L.stack, num3);
	}
}


void genStr()
{
	int len;
	int scale=3;
	for (int i=0; i&lt;MaxStringNumbers; i++)
	{
		len=rand()%scale+MaxStringLength-scale;//not empty
		for (int j=0; j&lt;len; j++)
		{
			strings[i][j]=rand()%2?'0':'1';
		}
		strings[i][j]='\0';
	}
	for (i=0; i&lt;MaxStringNumbers; i++)
	{
		printf(&quot;str%d:%s\n&quot;, i, strings[i]);
	}
}</pre>
<pre><span lang="en-ca"><font color="#0000FF"><b>How to run?</b></font></span></pre>
<pre><span lang="en-ca"><font color="#0000FF"><b>I try to get the longest common subsequence from FIVE strings by trying all their permutation of sequence.</b></font></span></pre>
<pre><span lang="en-ca"> </span></pre>
<pre><span lang="en-ca">1. The sequences gives you the sequence of index of strings for comparing strings.</span></pre>
<pre><span lang="en-ca">2. Secondly I copy the result common sequence to a buffer and compare with next string which index is in next of &quot;sequence&quot; array.</span></pre>
<pre><span lang="en-ca">3. Go on and on.</span></pre>
<pre><span lang="en-ca">4. Try next sequence which is another permutation of sequence of strings. </span></pre>
<pre><span lang="en-ca">5. The result is not necessarily same. And I fail to find a clue for algorithm of finding LCS among multi-sequences.</span></pre>
<pre>str0:010111001
str1:01010000
str2:110000011
str3:0110111
str4:000110001
The length is 6
str1=010111001
str2=01010000
the common subsequence is:010100
The length is 4
str1=010100
str2=110000011
the common subsequence is:1000
The length is 2
str1=1000
str2=0110111
the common subsequence is:10
The length is 2
str1=10
str2=000110001
the common subsequence is:10
the sequence is:
seq[0]=0;seq[1]=1;seq[2]=2;seq[3]=3;seq[4]=4;
The length is 6
str1=01010000
str2=010111001
the common subsequence is:010100
The length is 4
str1=010100
str2=110000011
the common subsequence is:1000
The length is 2
str1=1000
str2=0110111
the common subsequence is:10
The length is 2
str1=10
str2=000110001
the common subsequence is:10
the sequence is:
seq[0]=1;seq[1]=0;seq[2]=2;seq[3]=3;seq[4]=4;
The length is 6
str1=01010000
str2=110000011
the common subsequence is:100000
The length is 4
str1=100000
str2=010111001
the common subsequence is:1000
The length is 2
str1=1000
str2=0110111
the common subsequence is:10
The length is 2
str1=10
str2=000110001
the common subsequence is:10
the sequence is:
seq[0]=1;seq[1]=2;seq[2]=0;seq[3]=3;seq[4]=4;
The length is 6
str1=01010000
str2=110000011
the common subsequence is:100000
The length is 2
str1=100000
str2=0110111
the common subsequence is:10
The length is 2
str1=10
str2=010111001
the common subsequence is:10
The length is 2
str1=10
str2=000110001
the common subsequence is:10
the sequence is:
seq[0]=1;seq[1]=2;seq[2]=3;seq[3]=0;seq[4]=4;
The length is 6
str1=01010000
str2=110000011
the common subsequence is:100000
The length is 2
str1=100000
str2=0110111
the common subsequence is:10
The length is 2
str1=10
str2=000110001
the common subsequence is:10
The length is 2
str1=10
str2=010111001
the common subsequence is:10
the sequence is:
seq[0]=1;seq[1]=2;seq[2]=3;seq[3]=4;seq[4]=0;
The length is 6
str1=01010000
str2=110000011
the common subsequence is:100000
The length is 5
str1=100000
str2=000110001
the common subsequence is:00000
The length is 2
str1=00000
str2=0110111
the common subsequence is:00
The length is 2
str1=00
str2=010111001
the common subsequence is:00
the sequence is:
seq[0]=1;seq[1]=2;seq[2]=4;seq[3]=3;seq[4]=0;
The length is 6
str1=01010000
str2=110000011
the common subsequence is:100000
The length is 5
str1=100000
str2=000110001
the common subsequence is:00000
The length is 4
str1=00000
str2=010111001
the common subsequence is:0000
The length is 2
str1=0000
str2=0110111
the common subsequence is:00
the sequence is:
seq[0]=1;seq[1]=2;seq[2]=4;seq[3]=0;seq[4]=3;
The length is 4
str1=01010000
str2=0110111
the common subsequence is:0101
The length is 3
str1=0101
str2=110000011
the common subsequence is:101
The length is 3
str1=101
str2=010111001
the common subsequence is:101
The length is 3
str1=101
str2=000110001
the common subsequence is:101
the sequence is:
seq[0]=1;seq[1]=3;seq[2]=2;seq[3]=0;seq[4]=4;
The length is 4
str1=01010000
str2=0110111
the common subsequence is:0101
The length is 4
str1=0101
str2=010111001
the common subsequence is:0101
The length is 3
str1=0101
str2=110000011
the common subsequence is:101
The length is 3
str1=101
str2=000110001
the common subsequence is:101
the sequence is:
seq[0]=1;seq[1]=3;seq[2]=0;seq[3]=2;seq[4]=4;
The length is 4
str1=01010000
str2=0110111
the common subsequence is:0101
The length is 4
str1=0101
str2=010111001
the common subsequence is:0101
The length is 4
str1=0101
str2=000110001
the common subsequence is:0101
The length is 3
str1=0101
str2=110000011
the common subsequence is:101
the sequence is:
seq[0]=1;seq[1]=3;seq[2]=0;seq[3]=4;seq[4]=2;
The length is 4
str1=01010000
str2=0110111
the common subsequence is:0101
The length is 4
str1=0101
str2=000110001
the common subsequence is:0101
The length is 4
str1=0101
str2=010111001
the common subsequence is:0101
The length is 3
str1=0101
str2=110000011
the common subsequence is:101
the sequence is:
seq[0]=1;seq[1]=3;seq[2]=4;seq[3]=0;seq[4]=2;
The length is 4
str1=01010000
str2=0110111
the common subsequence is:0101
The length is 4
str1=0101
str2=000110001
the common subsequence is:0101
The length is 3
str1=0101
str2=110000011
the common subsequence is:101
The length is 3
str1=101
str2=010111001
the common subsequence is:101
the sequence is:
seq[0]=1;seq[1]=3;seq[2]=4;seq[3]=2;seq[4]=0;
The length is 6
str1=01010000
str2=000110001
the common subsequence is:001000
The length is 5
str1=001000
str2=110000011
the common subsequence is:00000
The length is 2
str1=00000
str2=0110111
the common subsequence is:00
The length is 2
str1=00
str2=010111001
the common subsequence is:00
the sequence is:
seq[0]=1;seq[1]=4;seq[2]=2;seq[3]=3;seq[4]=0;
The length is 6
str1=01010000
str2=000110001
the common subsequence is:001000
The length is 3
str1=001000
str2=0110111
the common subsequence is:001
The length is 3
str1=001
str2=110000011
the common subsequence is:001
The length is 3
str1=001
str2=010111001
the common subsequence is:001
the sequence is:
seq[0]=1;seq[1]=4;seq[2]=3;seq[3]=2;seq[4]=0;
The length is 6
str1=01010000
str2=000110001
the common subsequence is:001000
The length is 3
str1=001000
str2=0110111
the common subsequence is:001
The length is 3
str1=001
str2=010111001
the common subsequence is:001
The length is 3
str1=001
str2=110000011
the common subsequence is:001
the sequence is:
seq[0]=1;seq[1]=4;seq[2]=3;seq[3]=0;seq[4]=2;
The length is 6
str1=01010000
str2=000110001
the common subsequence is:001000
The length is 5
str1=001000
str2=010111001
the common subsequence is:00100
The length is 3
str1=00100
str2=0110111
the common subsequence is:001
The length is 3
str1=001
str2=110000011
the common subsequence is:001
the sequence is:
seq[0]=1;seq[1]=4;seq[2]=0;seq[3]=3;seq[4]=2;
The length is 6
str1=01010000
str2=000110001
the common subsequence is:001000
The length is 5
str1=001000
str2=010111001
the common subsequence is:00100
The length is 4
str1=00100
str2=110000011
the common subsequence is:0000
The length is 2
str1=0000
str2=0110111
the common subsequence is:00
the sequence is:
seq[0]=1;seq[1]=4;seq[2]=0;seq[3]=2;seq[4]=3;
The length is 6
str1=110000011
str2=01010000
the common subsequence is:110000
The length is 4
str1=110000
str2=010111001
the common subsequence is:1100
The length is 3
str1=1100
str2=0110111
the common subsequence is:110
The length is 3
str1=110
str2=000110001
the common subsequence is:110
the sequence is:
seq[0]=2;seq[1]=1;seq[2]=0;seq[3]=3;seq[4]=4;
The length is 5
str1=110000011
str2=010111001
the common subsequence is:11001
The length is 4
str1=11001
str2=01010000
the common subsequence is:1100
The length is 3
str1=1100
str2=0110111
the common subsequence is:110
The length is 3
str1=110
str2=000110001
the common subsequence is:110
the sequence is:
seq[0]=2;seq[1]=0;seq[2]=1;seq[3]=3;seq[4]=4;
The length is 5
str1=110000011
str2=010111001
the common subsequence is:11001
The length is 4
str1=11001
str2=0110111
the common subsequence is:1101
The length is 3
str1=1101
str2=01010000
the common subsequence is:110
The length is 3
str1=110
str2=000110001
the common subsequence is:110
the sequence is:
seq[0]=2;seq[1]=0;seq[2]=3;seq[3]=1;seq[4]=4;
The length is 5
str1=110000011
str2=010111001
the common subsequence is:11001
The length is 4
str1=11001
str2=0110111
the common subsequence is:1101
The length is 4
str1=1101
str2=000110001
the common subsequence is:1101
The length is 3
str1=1101
str2=01010000
the common subsequence is:110
the sequence is:
seq[0]=2;seq[1]=0;seq[2]=3;seq[3]=4;seq[4]=1;
The length is 5
str1=110000011
str2=010111001
the common subsequence is:11001
The length is 5
str1=11001
str2=000110001
the common subsequence is:11001
The length is 4
str1=11001
str2=0110111
the common subsequence is:1101
The length is 3
str1=1101
str2=01010000
the common subsequence is:110
the sequence is:
seq[0]=2;seq[1]=0;seq[2]=4;seq[3]=3;seq[4]=1;
The length is 5
str1=110000011
str2=010111001
the common subsequence is:11001
The length is 5
str1=11001
str2=000110001
the common subsequence is:11001
The length is 4
str1=11001
str2=01010000
the common subsequence is:1100
The length is 3
str1=1100
str2=0110111
the common subsequence is:110
the sequence is:
seq[0]=2;seq[1]=0;seq[2]=4;seq[3]=1;seq[4]=3;
The length is 5
str1=110000011
str2=0110111
the common subsequence is:11011
The length is 4
str1=11011
str2=010111001
the common subsequence is:1101
The length is 3
str1=1101
str2=01010000
the common subsequence is:110
The length is 3
str1=110
str2=000110001
the common subsequence is:110
the sequence is:
seq[0]=2;seq[1]=3;seq[2]=0;seq[3]=1;seq[4]=4;
The length is 5
str1=110000011
str2=0110111
the common subsequence is:11011
The length is 3
str1=11011
str2=01010000
the common subsequence is:110
The length is 3
str1=110
str2=010111001
the common subsequence is:110
The length is 3
str1=110
str2=000110001
the common subsequence is:110
the sequence is:
seq[0]=2;seq[1]=3;seq[2]=1;seq[3]=0;seq[4]=4;
The length is 5
str1=110000011
str2=0110111
the common subsequence is:11011
The length is 3
str1=11011
str2=01010000
the common subsequence is:110
The length is 3
str1=110
str2=000110001
the common subsequence is:110
The length is 3
str1=110
str2=010111001
the common subsequence is:110
the sequence is:
seq[0]=2;seq[1]=3;seq[2]=1;seq[3]=4;seq[4]=0;
The length is 5
str1=110000011
str2=0110111
the common subsequence is:11011
The length is 4
str1=11011
str2=000110001
the common subsequence is:1101
The length is 3
str1=1101
str2=01010000
the common subsequence is:110
The length is 3
str1=110
str2=010111001
the common subsequence is:110
the sequence is:
seq[0]=2;seq[1]=3;seq[2]=4;seq[3]=1;seq[4]=0;
The length is 5
str1=110000011
str2=0110111
the common subsequence is:11011
The length is 4
str1=11011
str2=000110001
the common subsequence is:1101
The length is 4
str1=1101
str2=010111001
the common subsequence is:1101
The length is 3
str1=1101
str2=01010000
the common subsequence is:110
the sequence is:
seq[0]=2;seq[1]=3;seq[2]=4;seq[3]=0;seq[4]=1;
The length is 6
str1=110000011
str2=000110001
the common subsequence is:110001
The length is 5
str1=110001
str2=010111001
the common subsequence is:11001
The length is 4
str1=11001
str2=0110111
the common subsequence is:1101
The length is 3
str1=1101
str2=01010000
the common subsequence is:110
the sequence is:
seq[0]=2;seq[1]=4;seq[2]=0;seq[3]=3;seq[4]=1;
The length is 6
str1=110000011
str2=000110001
the common subsequence is:110001
The length is 4
str1=110001
str2=0110111
the common subsequence is:1101
The length is 4
str1=1101
str2=010111001
the common subsequence is:1101
The length is 3
str1=1101
str2=01010000
the common subsequence is:110
the sequence is:
seq[0]=2;seq[1]=4;seq[2]=3;seq[3]=0;seq[4]=1;
The length is 6
str1=110000011
str2=000110001
the common subsequence is:110001
The length is 4
str1=110001
str2=0110111
the common subsequence is:1101
The length is 3
str1=1101
str2=01010000
the common subsequence is:110
The length is 3
str1=110
str2=010111001
the common subsequence is:110
the sequence is:
seq[0]=2;seq[1]=4;seq[2]=3;seq[3]=1;seq[4]=0;
The length is 6
str1=110000011
str2=000110001
the common subsequence is:110001
The length is 5
str1=110001
str2=01010000
the common subsequence is:11000
The length is 3
str1=11000
str2=0110111
the common subsequence is:110
The length is 3
str1=110
str2=010111001
the common subsequence is:110
the sequence is:
seq[0]=2;seq[1]=4;seq[2]=1;seq[3]=3;seq[4]=0;
The length is 6
str1=110000011
str2=000110001
the common subsequence is:110001
The length is 5
str1=110001
str2=01010000
the common subsequence is:11000
The length is 4
str1=11000
str2=010111001
the common subsequence is:1100
The length is 3
str1=1100
str2=0110111
the common subsequence is:110
the sequence is:
seq[0]=2;seq[1]=4;seq[2]=1;seq[3]=0;seq[4]=3;
The length is 4
str1=0110111
str2=01010000
the common subsequence is:0110
The length is 3
str1=0110
str2=110000011
the common subsequence is:011
The length is 3
str1=011
str2=010111001
the common subsequence is:011
The length is 3
str1=011
str2=000110001
the common subsequence is:011
the sequence is:
seq[0]=3;seq[1]=1;seq[2]=2;seq[3]=0;seq[4]=4;
The length is 5
str1=0110111
str2=110000011
the common subsequence is:11011
The length is 3
str1=11011
str2=01010000
the common subsequence is:110
The length is 3
str1=110
str2=010111001
the common subsequence is:110
The length is 3
str1=110
str2=000110001
the common subsequence is:110
the sequence is:
seq[0]=3;seq[1]=2;seq[2]=1;seq[3]=0;seq[4]=4;
The length is 5
str1=0110111
str2=110000011
the common subsequence is:11011
The length is 4
str1=11011
str2=010111001
the common subsequence is:1101
The length is 3
str1=1101
str2=01010000
the common subsequence is:110
The length is 3
str1=110
str2=000110001
the common subsequence is:110
the sequence is:
seq[0]=3;seq[1]=2;seq[2]=0;seq[3]=1;seq[4]=4;
The length is 5
str1=0110111
str2=110000011
the common subsequence is:11011
The length is 4
str1=11011
str2=010111001
the common subsequence is:1101
The length is 4
str1=1101
str2=000110001
the common subsequence is:1101
The length is 3
str1=1101
str2=01010000
the common subsequence is:110
the sequence is:
seq[0]=3;seq[1]=2;seq[2]=0;seq[3]=4;seq[4]=1;
The length is 5
str1=0110111
str2=110000011
the common subsequence is:11011
The length is 4
str1=11011
str2=000110001
the common subsequence is:1101
The length is 4
str1=1101
str2=010111001
the common subsequence is:1101
The length is 3
str1=1101
str2=01010000
the common subsequence is:110
the sequence is:
seq[0]=3;seq[1]=2;seq[2]=4;seq[3]=0;seq[4]=1;
The length is 5
str1=0110111
str2=110000011
the common subsequence is:11011
The length is 4
str1=11011
str2=000110001
the common subsequence is:1101
The length is 3
str1=1101
str2=01010000
the common subsequence is:110
The length is 3
str1=110
str2=010111001
the common subsequence is:110
the sequence is:
seq[0]=3;seq[1]=2;seq[2]=4;seq[3]=1;seq[4]=0;
The length is 6
str1=0110111
str2=010111001
the common subsequence is:011111
The length is 4
str1=011111
str2=110000011
the common subsequence is:1111
The length is 2
str1=1111
str2=01010000
the common subsequence is:11
The length is 2
str1=11
str2=000110001
the common subsequence is:11
the sequence is:
seq[0]=3;seq[1]=0;seq[2]=2;seq[3]=1;seq[4]=4;
The length is 6
str1=0110111
str2=010111001
the common subsequence is:011111
The length is 3
str1=011111
str2=01010000
the common subsequence is:011
The length is 3
str1=011
str2=110000011
the common subsequence is:011
The length is 3
str1=011
str2=000110001
the common subsequence is:011
the sequence is:
seq[0]=3;seq[1]=0;seq[2]=1;seq[3]=2;seq[4]=4;
The length is 6
str1=0110111
str2=010111001
the common subsequence is:011111
The length is 3
str1=011111
str2=01010000
the common subsequence is:011
The length is 3
str1=011
str2=000110001
the common subsequence is:011
The length is 3
str1=011
str2=110000011
the common subsequence is:011
the sequence is:
seq[0]=3;seq[1]=0;seq[2]=1;seq[3]=4;seq[4]=2;
The length is 6
str1=0110111
str2=010111001
the common subsequence is:011111
The length is 4
str1=011111
str2=000110001
the common subsequence is:0111
The length is 3
str1=0111
str2=01010000
the common subsequence is:011
The length is 3
str1=011
str2=110000011
the common subsequence is:011
the sequence is:
seq[0]=3;seq[1]=0;seq[2]=4;seq[3]=1;seq[4]=2;
The length is 6
str1=0110111
str2=010111001
the common subsequence is:011111
The length is 4
str1=011111
str2=000110001
the common subsequence is:0111
The length is 3
str1=0111
str2=110000011
the common subsequence is:011
The length is 3
str1=011
str2=01010000
the common subsequence is:011
the sequence is:
seq[0]=3;seq[1]=0;seq[2]=4;seq[3]=2;seq[4]=1;
The length is 5
str1=0110111
str2=000110001
the common subsequence is:01101
The length is 4
str1=01101
str2=110000011
the common subsequence is:1101
The length is 4
str1=1101
str2=010111001
the common subsequence is:1101
The length is 3
str1=1101
str2=01010000
the common subsequence is:110
the sequence is:
seq[0]=3;seq[1]=4;seq[2]=2;seq[3]=0;seq[4]=1;
The length is 5
str1=0110111
str2=000110001
the common subsequence is:01101
The length is 5
str1=01101
str2=010111001
the common subsequence is:01101
The length is 4
str1=01101
str2=110000011
the common subsequence is:1101
The length is 3
str1=1101
str2=01010000
the common subsequence is:110
the sequence is:
seq[0]=3;seq[1]=4;seq[2]=0;seq[3]=2;seq[4]=1;
The length is 5
str1=0110111
str2=000110001
the common subsequence is:01101
The length is 5
str1=01101
str2=010111001
the common subsequence is:01101
The length is 4
str1=01101
str2=01010000
the common subsequence is:0110
The length is 3
str1=0110
str2=110000011
the common subsequence is:011
the sequence is:
seq[0]=3;seq[1]=4;seq[2]=0;seq[3]=1;seq[4]=2;
The length is 5
str1=0110111
str2=000110001
the common subsequence is:01101
The length is 4
str1=01101
str2=01010000
the common subsequence is:0110
The length is 4
str1=0110
str2=010111001
the common subsequence is:0110
The length is 3
str1=0110
str2=110000011
the common subsequence is:011
the sequence is:
seq[0]=3;seq[1]=4;seq[2]=1;seq[3]=0;seq[4]=2;
The length is 5
str1=0110111
str2=000110001
the common subsequence is:01101
The length is 4
str1=01101
str2=01010000
the common subsequence is:0110
The length is 3
str1=0110
str2=110000011
the common subsequence is:011
The length is 3
str1=011
str2=010111001
the common subsequence is:011
the sequence is:
seq[0]=3;seq[1]=4;seq[2]=1;seq[3]=2;seq[4]=0;
The length is 6
str1=000110001
str2=01010000
the common subsequence is:001000
The length is 5
str1=001000
str2=110000011
the common subsequence is:00000
The length is 2
str1=00000
str2=0110111
the common subsequence is:00
The length is 2
str1=00
str2=010111001
the common subsequence is:00
the sequence is:
seq[0]=4;seq[1]=1;seq[2]=2;seq[3]=3;seq[4]=0;
The length is 6
str1=000110001
str2=110000011
the common subsequence is:000001
The length is 5
str1=000001
str2=01010000
the common subsequence is:00000
The length is 2
str1=00000
str2=0110111
the common subsequence is:00
The length is 2
str1=00
str2=010111001
the common subsequence is:00
the sequence is:
seq[0]=4;seq[1]=2;seq[2]=1;seq[3]=3;seq[4]=0;
The length is 6
str1=000110001
str2=110000011
the common subsequence is:000001
The length is 3
str1=000001
str2=0110111
the common subsequence is:001
The length is 3
str1=001
str2=01010000
the common subsequence is:001
The length is 3
str1=001
str2=010111001
the common subsequence is:001
the sequence is:
seq[0]=4;seq[1]=2;seq[2]=3;seq[3]=1;seq[4]=0;
The length is 6
str1=000110001
str2=110000011
the common subsequence is:000001
The length is 3
str1=000001
str2=0110111
the common subsequence is:001
The length is 3
str1=001
str2=010111001
the common subsequence is:001
The length is 3
str1=001
str2=01010000
the common subsequence is:001
the sequence is:
seq[0]=4;seq[1]=2;seq[2]=3;seq[3]=0;seq[4]=1;
The length is 6
str1=000110001
str2=110000011
the common subsequence is:000001
The length is 5
str1=000001
str2=010111001
the common subsequence is:00001
The length is 3
str1=00001
str2=0110111
the common subsequence is:001
The length is 3
str1=001
str2=01010000
the common subsequence is:001
the sequence is:
seq[0]=4;seq[1]=2;seq[2]=0;seq[3]=3;seq[4]=1;
The length is 6
str1=000110001
str2=110000011
the common subsequence is:000001
The length is 5
str1=000001
str2=010111001
the common subsequence is:00001
The length is 4
str1=00001
str2=01010000
the common subsequence is:0000
The length is 2
str1=0000
str2=0110111
the common subsequence is:00
the sequence is:
seq[0]=4;seq[1]=2;seq[2]=0;seq[3]=1;seq[4]=3;
The length is 5
str1=000110001
str2=0110111
the common subsequence is:01101
The length is 4
str1=01101
str2=110000011
the common subsequence is:1101
The length is 3
str1=1101
str2=01010000
the common subsequence is:110
The length is 3
str1=110
str2=010111001
the common subsequence is:110
the sequence is:
seq[0]=4;seq[1]=3;seq[2]=2;seq[3]=1;seq[4]=0;
The length is 5
str1=000110001
str2=0110111
the common subsequence is:01101
The length is 4
str1=01101
str2=01010000
the common subsequence is:0110
The length is 3
str1=0110
str2=110000011
the common subsequence is:011
The length is 3
str1=011
str2=010111001
the common subsequence is:011
the sequence is:
seq[0]=4;seq[1]=3;seq[2]=1;seq[3]=2;seq[4]=0;
The length is 5
str1=000110001
str2=0110111
the common subsequence is:01101
The length is 4
str1=01101
str2=01010000
the common subsequence is:0110
The length is 4
str1=0110
str2=010111001
the common subsequence is:0110
The length is 3
str1=0110
str2=110000011
the common subsequence is:011
the sequence is:
seq[0]=4;seq[1]=3;seq[2]=1;seq[3]=0;seq[4]=2;
The length is 5
str1=000110001
str2=0110111
the common subsequence is:01101
The length is 5
str1=01101
str2=010111001
the common subsequence is:01101
The length is 4
str1=01101
str2=01010000
the common subsequence is:0110
The length is 3
str1=0110
str2=110000011
the common subsequence is:011
the sequence is:
seq[0]=4;seq[1]=3;seq[2]=0;seq[3]=1;seq[4]=2;
The length is 5
str1=000110001
str2=0110111
the common subsequence is:01101
The length is 5
str1=01101
str2=010111001
the common subsequence is:01101
The length is 4
str1=01101
str2=110000011
the common subsequence is:1101
The length is 3
str1=1101
str2=01010000
the common subsequence is:110
the sequence is:
seq[0]=4;seq[1]=3;seq[2]=0;seq[3]=2;seq[4]=1;
The length is 7
str1=000110001
str2=010111001
the common subsequence is:0011001
The length is 5
str1=0011001
str2=110000011
the common subsequence is:11001
The length is 4
str1=11001
str2=0110111
the common subsequence is:1101
The length is 3
str1=1101
str2=01010000
the common subsequence is:110
the sequence is:
seq[0]=4;seq[1]=0;seq[2]=2;seq[3]=3;seq[4]=1;
The length is 7
str1=000110001
str2=010111001
the common subsequence is:0011001
The length is 5
str1=0011001
str2=0110111
the common subsequence is:01101
The length is 4
str1=01101
str2=110000011
the common subsequence is:1101
The length is 3
str1=1101
str2=01010000
the common subsequence is:110
the sequence is:
seq[0]=4;seq[1]=0;seq[2]=3;seq[3]=2;seq[4]=1;
The length is 7
str1=000110001
str2=010111001
the common subsequence is:0011001
The length is 5
str1=0011001
str2=0110111
the common subsequence is:01101
The length is 4
str1=01101
str2=01010000
the common subsequence is:0110
The length is 3
str1=0110
str2=110000011
the common subsequence is:011
the sequence is:
seq[0]=4;seq[1]=0;seq[2]=3;seq[3]=1;seq[4]=2;
The length is 7
str1=000110001
str2=010111001
the common subsequence is:0011001
The length is 5
str1=0011001
str2=01010000
the common subsequence is:00100
The length is 3
str1=00100
str2=0110111
the common subsequence is:001
The length is 3
str1=001
str2=110000011
the common subsequence is:001
the sequence is:
seq[0]=4;seq[1]=0;seq[2]=1;seq[3]=3;seq[4]=2;
The length is 7
str1=000110001
str2=010111001
the common subsequence is:0011001
The length is 5
str1=0011001
str2=01010000
the common subsequence is:00100
The length is 4
str1=00100
str2=110000011
the common subsequence is:0000
The length is 2
str1=0000
str2=0110111
the common subsequence is:00
the sequence is:
seq[0]=4;seq[1]=0;seq[2]=1;seq[3]=2;seq[4]=3;
</pre>

<pre></pre>

<pre></pre>

<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;                                   
&nbsp;&nbsp;&nbsp; <a href="game24.htm">                  







                       <img src="picture/back.gif" style="border: medium none" alt="back.gif (341 bytes)" width="32" height="35"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
<a href="index.htm">
<img src="picture/up.gif" style="border: medium none" alt="up.gif (335 bytes)" width="35" height="32"></a>       &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;                         
<img src="picture/next.gif" style="border: medium none" alt="next.gif (337 bytes)" width="32" height="35">          


</p>

</body>

</html>