<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; <span lang="en-ca">Monotone Array</span></b></font></p>

<div align="left">
  <pre><b><font color="#ff0000" size="5">A. <span lang="en-ca">First </span>Edition</font></b></pre>
</div>
<div align="left">
  <pre><span lang="en-ca"><b>This is one of problem in assignment of comp465 and it is regarded as a joke because professor said it is for fun.</b></span></pre>
</div>
<div align="left">
  <pre><span lang="en-ca"><b>But I spent quite a lot of time thinking about it. Actually, I made a cheap mistake before my classmates pointed </b></span></pre>
</div>
<div align="left">
  <pre><span lang="en-ca"><b>out. My mind cannot move after one night's killing in Diablo(I) in Battle.net. It is Diablo ONE not Two!</b></span></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>
<div align="left">
  <font FACE="CMR12">
  <p ALIGN="LEFT">A two-dimensional array </font><font FACE="CMMI12">a </font>
  <font FACE="CMR12">is called </font><font FACE="CMTI12">monotone </font>
  <font FACE="CMR12">if</p>
  </font><font FACE="CMMI12">
  <p ALIGN="LEFT">a</font><font FACE="CMR12">(</font><font FACE="CMMI12">i, j</font><font FACE="CMR12">)
  </font><font FACE="CMSY10">&#20; </font><font FACE="CMMI12">a</font><font FACE="CMR12">(</font><font FACE="CMMI12">i
  </font><font FACE="CMR12">+ 1</font><font FACE="CMMI12">, j</font><font FACE="CMR12">) 
  and </font><font FACE="CMMI12">a</font><font FACE="CMR12">(</font><font FACE="CMMI12">i, 
  j</font><font FACE="CMR12">) </font><font FACE="CMSY10">&#20; </font>
  <font FACE="CMMI12">a</font><font FACE="CMR12">(</font><font FACE="CMMI12">i, 
  j </font><font FACE="CMR12">+ 1)</p>
  <p ALIGN="LEFT">for all </font><font FACE="CMMI12">i </font>
  <font FACE="CMR12">and </font><font FACE="CMMI12">j</font><font FACE="CMR12">. 
  Design an algorithm that, given an </font><font FACE="CMMI12">n</font><font FACE="CMSY10">กม</font><font FACE="CMMI12">n
  </font><font FACE="CMR12">monotone array </font><font FACE="CMMI12">a </font>
  <font FACE="CMR12">of</p>
  <p ALIGN="LEFT">integers, returns either a pair (</font><font FACE="CMMI12">i, 
  j</font><font FACE="CMR12">) such that </font><font FACE="CMMI12">a</font><font FACE="CMR12">(</font><font FACE="CMMI12">i, 
  j</font><font FACE="CMR12">) = 0 or a message </font><font FACE="CMCSC10">
  tough</p>
  <p ALIGN="LEFT">luck </font><font FACE="CMR12">signifying that no such pair 
  exists. Your objective is to minimize the</p>
  <p ALIGN="LEFT">worst-case number of entries of </font><font FACE="CMMI12">a
  </font><font FACE="CMR12">that your algorithm consults (</font><font FACE="CMMI12">n</font><font FACE="CMR8" SIZE="1">2
  </font><font FACE="CMR12">is trivial</p>
  <p ALIGN="LEFT">and </font><font FACE="CMMI12">n</font><font FACE="CMSY10">d</font><font FACE="CMR12">lg
  </font><font FACE="CMMI12">n</font><font FACE="CMSY10">e </font>
  <font FACE="CMR12">is easy; to get any points, you must do better than </font>
  <font FACE="CMMI12">O</font><font FACE="CMR12">(</font><font FACE="CMMI12">n
  </font><font FACE="CMR12">lg </font><font FACE="CMMI12">n</font><font FACE="CMR12">)).</p>
  <p ALIGN="LEFT">Present your algorithm in the pseudocode style of Question 1.</p>
  <p ALIGN="LEFT">(This problem has nothing to do with any material covered in 
  class; it is</p>
  <p ALIGN="LEFT">simply a fun exercise in the design of e&#14;cient algorithms.)</p>
  </font>
  <pre>กก</pre>
</div>
<p ALIGN="LEFT"><span lang="en-ca"><font size="2"><b>1. An array of nxn and has 
such property that for every entry [i,j], it is always bigger than both upper 
and left engtry: [i-1,j] and [i, j-1]. This is called monotone array of size of 
n.</b></font></span></p>
<p ALIGN="LEFT"><span lang="en-ca"><font size="2"><b>2. Can you find if the 
array has at least one entry which is 0? Don't say you can do it by binary 
search which is trivial. Don't say you need sort because it is a kind of sorted.</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>Originally it is proposed 
by some other guy, but he didn't believe it shortly. I had a feeling that it is 
divide-and-conquer like Strasseng's algorithm.</b></font></span></p>
<p ALIGN="LEFT"><span lang="en-ca"><font size="2"><b>First you search along the 
diagonal of matrix until you encounter the positive entry. Then you divide 
matrix into four parts by row and column passing this entry: both the upper-left 
and lower-right will not contain 0 because one includes all negative and the 
other includes all positive. The upper-right and lower-left is your target which 
are two sub-matrix containing both positive and negative numbers. You recursive 
call to solve these two sub-matrix.</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><span lang="en-ca"><font size="2"><b>I tried to confirm my idea by running single test and multi-test which simply iterates a number of times and </b></font></span></pre>
</div>
<div align="left">
  <pre><span lang="en-ca"><font size="2"><b>calculates the average number of comparison operations of entries which is a scale of big O.</b></font></span></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">. monotone.cpp</span></b></font></pre>
</div>
<div align="left">
  <pre><span lang="en-ca"><font size="3" color="#FF0000"><b>file name: monotone.cpp</b></font></span></pre>
</div>
<pre>#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;time.h&gt;
#include &lt;string.h&gt;

const int ArraySize=20;
const int Step=8;
int array[ArraySize][ArraySize];

void initialize();

void display(int startR, int startC, int row, int col);

void construct(int row, int col);
bool search(int startR, int startC, int row, int col);

int counter=0;
bool showTrace=false;
bool noDisplay=true;

int testNumber=20;

double monoRun();

void singleTest();
void multiTest();

int main(int argc, char* argv[])
{
	srand(time(0));
/*
	if (argc==2)
	{
		if (strcmp(argv[1], &quot;trace&quot;)==0)
		{
			showTrace=true;
		}	
	}
*/
	printf(&quot;single test no. 1\n&quot;);
	singleTest();
	printf(&quot;single test no. 2\n&quot;);
	singleTest();
	printf(&quot;multi test \n&quot;);
	multiTest();
	return 0;
}

void singleTest()
{
	showTrace=true;
	noDisplay=false;
	monoRun();
}

void multiTest()
{
	double result=0;

	showTrace=false;
	noDisplay=true;
	for (int i=0; i&lt;testNumber; i++)
	{
		result+=monoRun();
	}
	printf(&quot;\n%d times and average is %g\n&quot;, testNumber, result/testNumber);
}

double monoRun()
{
	initialize();
	if (!noDisplay)
	{
		display(0, 0, ArraySize, ArraySize);
	}
	if (search(0, 0, ArraySize, ArraySize))
	{
		printf(&quot;\nfind it! at counter/ArraySize=%d/%d=%f\n&quot;, counter, ArraySize,
			(double)counter/ArraySize);
	}
	else
	{
		printf(&quot;\nNo luck! counter/ArraySize=%d/%d=%f\n&quot;, counter, ArraySize,
			(double)counter/ArraySize);
	}
	return (double)counter/ArraySize;
}

bool search(int startR, int startC, int row, int col)
{
	int r=startR, c=startC;
	if (row==0||col==0)
	{
		return false;
	}
	if (showTrace)
	{
		display(startR, startC, row, col);
	}
	while (array[r][c]&lt;0)
	{
		r++;
		c++;
		counter++;//comparison
		if (r==startR+row||c==startC+col)
		{
			break;
		}
	}
	counter++;//comparison
	if (r&lt;ArraySize&amp;&amp;c&lt;ArraySize)
	{
		if (array[r][c]==0)
		{
			printf(&quot;\nfind it! array[%d][%d]=0\n&quot;, r, c);
			return true;
		}
	}
	return search(r, startC, row-r+startR, c-startC)||search(startR, c, r-startR, col-c+startC);
}



void construct(int row, int col)
{
	int left, upper, prev;
	if (row==ArraySize||col==ArraySize)
	{
		return;
	}
	
	if (row-1&gt;=0&amp;&amp;col-1&gt;=0)
	{
		upper=array[row-1][col];
		left=array[row][col-1];
	}
	else
	{
		if (row-1&lt;0&amp;&amp;col-1&gt;=0)
		{
			upper=left=array[row][col-1];
		}
		else
		{
			if (row-1&gt;=0&amp;&amp;col-1&lt;0)
			{
				upper=left=array[row-1][col];
			}
			else
			{
				//row=col==0, starting
				upper=left=-50;
			}
			
		}
	}
	prev=upper&gt;left?upper:left;
	array[row][col]=prev+rand()%Step;//increase step everytime
	construct(row+1, col);
	construct(row, col+1);
	construct(row+1, col+1);
}

void display(int startR, int startC, int row, int col)
{
	printf(&quot;\n&quot;);
	for (int r=startR; r&lt;startR+row; r++)
	{
		printf(&quot;row[%d]\t&quot;, r);
		for (int c=startC; c&lt;startC+col; c++)
		{
			printf(&quot;%-5d&quot;, array[r][c]);
		}
		printf(&quot;\n&quot;);
	}
}

int max(int i, int j)
{
	return i&gt;j?i:j;
}

void initialize()
{
	int max(int i, int j);
	counter=0;
	for (int r=0; r&lt;ArraySize; r++)
	{
		for (int c=0; c&lt;ArraySize; c++)
		{
			if (r==0&amp;&amp;c==0)
			{
				array[r][c]=-50;
			}
			else
			{
				if (r==0&amp;&amp;c!=0)
				{
					array[r][c]=array[r][c-1]+rand()%Step;
				}
				else
				{
					if (r!=0&amp;&amp;c==0)
					{
						array[r][c]=array[r-1][c]+rand()%Step;
					}
					else
					{
						array[r][c]=max(array[r-1][c], array[r][c-1])+rand()%Step;
					}
				}
			}
		}
	}
	//construct(0, 0);
}

</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 single test shows you each step the search goes through.</span></pre>
<pre><span lang="en-ca">2. The multi-test doesn't show searching procedure and only calculates the average.</span></pre>
<p>single test no. 1<br>
<br>
row[0] -50 -45 -44 -39 -39 -33 -29 -24 -23 -21 -16 -9 -4 1 4 9 12 18 19 21 <br>
row[1] -49 -41 -40 -32 -27 -24 -17 -11 -6 0 7 10 14 21 23 30 36 41 45 52 <br>
row[2] -43 -35 -34 -27 -22 -17 -15 -6 0 5 10 13 14 28 35 38 42 42 50 52 <br>
row[3] -36 -28 -24 -22 -20 -12 -7 -4 0 11 12 20 20 35 38 44 48 49 56 61 <br>
row[4] -35 -23 -21 -20 -20 -5 -2 -1 4 11 15 22 27 42 44 48 52 52 59 66 <br>
row[5] -35 -23 -21 -15 -15 -5 -2 1 6 11 15 27 31 47 47 52 53 58 66 67 <br>
row[6] -29 -20 -18 -12 -7 2 3 6 8 11 17 29 35 51 54 55 61 68 70 71 <br>
row[7] -22 -18 -11 -6 0 8 12 16 18 19 22 32 37 51 55 58 61 74 76 82 <br>
row[8] -19 -14 -6 -6 5 10 13 20 22 26 26 36 39 51 58 63 64 81 87 89 <br>
row[9] -14 -12 0 0 12 12 13 22 28 33 36 41 41 56 59 70 73 82 89 93 <br>
row[10] -11 -11 2 3 16 18 22 27 31 34 43 47 47 57 59 76 83 85 96 96 <br>
row[11] -4 0 8 9 17 20 22 34 39 40 50 52 54 60 61 78 89 96 99 104 <br>
row[12] 1 5 14 18 22 28 29 40 40 47 57 62 64 66 69 78 95 100 101 104 <br>
row[13] 6 9 21 28 28 32 36 45 50 50 64 69 76 83 86 86 96 100 103 105 <br>
row[14] 9 15 28 29 29 39 40 48 57 59 69 71 77 90 92 93 98 104 107 111 <br>
row[15] 13 19 29 35 35 41 48 50 64 71 73 78 78 90 92 97 100 108 108 113 <br>
row[16] 17 24 32 40 42 46 49 52 67 73 80 85 87 94 101 107 109 115 116 117 <br>
row[17] 22 28 33 44 50 55 56 62 72 74 80 91 95 99 104 108 109 118 121 122 <br>
row[18] 24 35 42 46 56 56 59 68 75 78 81 95 99 106 106 113 120 124 126 133 <br>
row[19] 28 40 44 51 56 56 64 75 78 82 82 100 106 108 111 115 121 131 136 143 <br>
<br>
row[0] -50 -45 -44 -39 -39 -33 -29 -24 -23 -21 -16 -9 -4 1 4 9 12 18 19 21 <br>
row[1] -49 -41 -40 -32 -27 -24 -17 -11 -6 0 7 10 14 21 23 30 36 41 45 52 <br>
row[2] -43 -35 -34 -27 -22 -17 -15 -6 0 5 10 13 14 28 35 38 42 42 50 52 <br>
row[3] -36 -28 -24 -22 -20 -12 -7 -4 0 11 12 20 20 35 38 44 48 49 56 61 <br>
row[4] -35 -23 -21 -20 -20 -5 -2 -1 4 11 15 22 27 42 44 48 52 52 59 66 <br>
row[5] -35 -23 -21 -15 -15 -5 -2 1 6 11 15 27 31 47 47 52 53 58 66 67 <br>
row[6] -29 -20 -18 -12 -7 2 3 6 8 11 17 29 35 51 54 55 61 68 70 71 <br>
row[7] -22 -18 -11 -6 0 8 12 16 18 19 22 32 37 51 55 58 61 74 76 82 <br>
row[8] -19 -14 -6 -6 5 10 13 20 22 26 26 36 39 51 58 63 64 81 87 89 <br>
row[9] -14 -12 0 0 12 12 13 22 28 33 36 41 41 56 59 70 73 82 89 93 <br>
row[10] -11 -11 2 3 16 18 22 27 31 34 43 47 47 57 59 76 83 85 96 96 <br>
row[11] -4 0 8 9 17 20 22 34 39 40 50 52 54 60 61 78 89 96 99 104 <br>
row[12] 1 5 14 18 22 28 29 40 40 47 57 62 64 66 69 78 95 100 101 104 <br>
row[13] 6 9 21 28 28 32 36 45 50 50 64 69 76 83 86 86 96 100 103 105 <br>
row[14] 9 15 28 29 29 39 40 48 57 59 69 71 77 90 92 93 98 104 107 111 <br>
row[15] 13 19 29 35 35 41 48 50 64 71 73 78 78 90 92 97 100 108 108 113 <br>
row[16] 17 24 32 40 42 46 49 52 67 73 80 85 87 94 101 107 109 115 116 117 <br>
row[17] 22 28 33 44 50 55 56 62 72 74 80 91 95 99 104 108 109 118 121 122 <br>
row[18] 24 35 42 46 56 56 59 68 75 78 81 95 99 106 106 113 120 124 126 133 <br>
row[19] 28 40 44 51 56 56 64 75 78 82 82 100 106 108 111 115 121 131 136 143 <br>
<br>
row[6] -29 -20 -18 -12 -7 2 <br>
row[7] -22 -18 -11 -6 0 8 <br>
row[8] -19 -14 -6 -6 5 10 <br>
row[9] -14 -12 0 0 12 12 <br>
row[10] -11 -11 2 3 16 18 <br>
row[11] -4 0 8 9 17 20 <br>
row[12] 1 5 14 18 22 28 <br>
row[13] 6 9 21 28 28 32 <br>
row[14] 9 15 28 29 29 39 <br>
row[15] 13 19 29 35 35 41 <br>
row[16] 17 24 32 40 42 46 <br>
row[17] 22 28 33 44 50 55 <br>
row[18] 24 35 42 46 56 56 <br>
row[19] 28 40 44 51 56 56 <br>
<br>
find it! array[9][3]=0<br>
<br>
find it! at counter/ArraySize=11/20=0.550000<br>
single test no. 2<br>
<br>
row[0] -50 -46 -45 -45 -40 -36 -29 -24 -17 -16 -10 -7 -7 -1 0 5 6 6 7 9 <br>
row[1] -45 -43 -37 -36 -36 -36 -25 -21 -12 -9 -8 -4 3 8 14 18 21 26 31 34 <br>
row[2] -41 -36 -34 -29 -22 -20 -16 -15 -12 -5 1 2 7 15 16 23 24 26 36 36 <br>
row[3] -38 -32 -32 -22 -22 -14 -9 -9 -3 4 4 11 14 18 19 30 35 36 43 50 <br>
row[4] -34 -29 -29 -20 -15 -14 -3 1 1 10 14 16 20 23 24 31 36 42 47 51 <br>
row[5] -28 -26 -25 -17 -11 -8 -1 2 5 13 16 22 26 33 39 45 51 57 62 68 <br>
row[6] -23 -21 -19 -10 -10 -6 6 13 14 20 23 24 29 38 46 52 59 63 69 73 <br>
row[7] -16 -16 -12 -4 3 9 10 17 18 20 28 32 32 41 52 53 66 73 80 83 <br>
row[8] -14 -7 -3 4 9 10 13 18 22 22 33 40 43 43 58 65 73 74 80 87 <br>
row[9] -10 -7 4 9 10 12 14 25 26 29 37 44 47 54 62 69 77 83 88 91 <br>
row[10] -7 -2 10 12 18 20 27 29 32 32 41 51 52 58 64 71 77 90 92 93 <br>
row[11] -1 5 14 17 22 28 33 39 39 43 47 55 59 63 66 77 84 97 97 104 <br>
row[12] 2 8 19 23 30 36 43 44 49 51 53 55 65 65 73 84 89 103 110 117 <br>
row[13] 4 10 20 27 30 40 43 46 49 58 58 62 72 73 75 87 95 107 116 122 <br>
row[14] 5 13 20 30 32 40 50 50 56 63 65 72 72 75 78 91 100 114 116 128 <br>
row[15] 5 15 20 33 40 43 54 58 64 70 76 79 81 82 87 94 100 121 122 134 <br>
row[16] 12 19 25 37 44 46 57 61 68 73 80 82 89 89 96 99 103 122 124 134 <br>
row[17] 19 25 32 42 45 52 58 67 70 78 87 89 89 92 96 99 107 125 125 135 <br>
row[18] 25 27 34 49 54 55 64 71 74 81 92 98 99 102 105 107 114 125 128 141 <br>
row[19] 31 33 35 52 56 58 68 74 76 86 95 105 106 108 110 114 116 129 134 148 <br>
<br>
row[0] -50 -46 -45 -45 -40 -36 -29 -24 -17 -16 -10 -7 -7 -1 0 5 6 6 7 9 <br>
row[1] -45 -43 -37 -36 -36 -36 -25 -21 -12 -9 -8 -4 3 8 14 18 21 26 31 34 <br>
row[2] -41 -36 -34 -29 -22 -20 -16 -15 -12 -5 1 2 7 15 16 23 24 26 36 36 <br>
row[3] -38 -32 -32 -22 -22 -14 -9 -9 -3 4 4 11 14 18 19 30 35 36 43 50 <br>
row[4] -34 -29 -29 -20 -15 -14 -3 1 1 10 14 16 20 23 24 31 36 42 47 51 <br>
row[5] -28 -26 -25 -17 -11 -8 -1 2 5 13 16 22 26 33 39 45 51 57 62 68 <br>
row[6] -23 -21 -19 -10 -10 -6 6 13 14 20 23 24 29 38 46 52 59 63 69 73 <br>
row[7] -16 -16 -12 -4 3 9 10 17 18 20 28 32 32 41 52 53 66 73 80 83 <br>
row[8] -14 -7 -3 4 9 10 13 18 22 22 33 40 43 43 58 65 73 74 80 87 <br>
row[9] -10 -7 4 9 10 12 14 25 26 29 37 44 47 54 62 69 77 83 88 91 <br>
row[10] -7 -2 10 12 18 20 27 29 32 32 41 51 52 58 64 71 77 90 92 93 <br>
row[11] -1 5 14 17 22 28 33 39 39 43 47 55 59 63 66 77 84 97 97 104 <br>
row[12] 2 8 19 23 30 36 43 44 49 51 53 55 65 65 73 84 89 103 110 117 <br>
row[13] 4 10 20 27 30 40 43 46 49 58 58 62 72 73 75 87 95 107 116 122 <br>
row[14] 5 13 20 30 32 40 50 50 56 63 65 72 72 75 78 91 100 114 116 128 <br>
row[15] 5 15 20 33 40 43 54 58 64 70 76 79 81 82 87 94 100 121 122 134 <br>
row[16] 12 19 25 37 44 46 57 61 68 73 80 82 89 89 96 99 103 122 124 134 <br>
row[17] 19 25 32 42 45 52 58 67 70 78 87 89 89 92 96 99 107 125 125 135 <br>
row[18] 25 27 34 49 54 55 64 71 74 81 92 98 99 102 105 107 114 125 128 141 <br>
row[19] 31 33 35 52 56 58 68 74 76 86 95 105 106 108 110 114 116 129 134 148 <br>
<br>
row[6] -23 -21 -19 -10 -10 -6 <br>
row[7] -16 -16 -12 -4 3 9 <br>
row[8] -14 -7 -3 4 9 10 <br>
row[9] -10 -7 4 9 10 12 <br>
row[10] -7 -2 10 12 18 20 <br>
row[11] -1 5 14 17 22 28 <br>
row[12] 2 8 19 23 30 36 <br>
row[13] 4 10 20 27 30 40 <br>
row[14] 5 13 20 30 32 40 <br>
row[15] 5 15 20 33 40 43 <br>
row[16] 12 19 25 37 44 46 <br>
row[17] 19 25 32 42 45 52 <br>
row[18] 25 27 34 49 54 55 <br>
row[19] 31 33 35 52 56 58 <br>
<br>
row[9] -10 -7 4 <br>
row[10] -7 -2 10 <br>
row[11] -1 5 14 <br>
row[12] 2 8 19 <br>
row[13] 4 10 20 <br>
row[14] 5 13 20 <br>
row[15] 5 15 20 <br>
row[16] 12 19 25 <br>
row[17] 19 25 32 <br>
row[18] 25 27 34 <br>
row[19] 31 33 35 <br>
<br>
row[11] -1 5 <br>
row[12] 2 8 <br>
row[13] 4 10 <br>
row[14] 5 13 <br>
row[15] 5 15 <br>
row[16] 12 19 <br>
row[17] 19 25 <br>
row[18] 25 27 <br>
row[19] 31 33 <br>
<br>
row[12] 2 <br>
row[13] 4 <br>
row[14] 5 <br>
row[15] 5 <br>
row[16] 12 <br>
row[17] 19 <br>
row[18] 25 <br>
row[19] 31 <br>
<br>
row[11] 5 <br>
<br>
row[9] 4 <br>
row[10] 10 <br>
<br>
row[6] -10 -10 -6 <br>
row[7] -4 3 9 <br>
row[8] 4 9 10 <br>
<br>
row[7] -4 <br>
row[8] 4 <br>
<br>
row[8] 4 <br>
<br>
row[6] -10 -6 <br>
<br>
row[6] -6 <br>
<br>
row[0] -29 -24 -17 -16 -10 -7 -7 -1 0 5 6 6 7 9 <br>
row[1] -25 -21 -12 -9 -8 -4 3 8 14 18 21 26 31 34 <br>
row[2] -16 -15 -12 -5 1 2 7 15 16 23 24 26 36 36 <br>
row[3] -9 -9 -3 4 4 11 14 18 19 30 35 36 43 50 <br>
row[4] -3 1 1 10 14 16 20 23 24 31 36 42 47 51 <br>
row[5] -1 2 5 13 16 22 26 33 39 45 51 57 62 68 <br>
<br>
row[3] -9 -9 -3 <br>
row[4] -3 1 1 <br>
row[5] -1 2 5 <br>
<br>
row[4] -3 <br>
row[5] -1 <br>
<br>
row[5] -1 <br>
<br>
row[3] -9 -3 <br>
<br>
row[3] -3 <br>
<br>
row[0] -16 -10 -7 -7 -1 0 5 6 6 7 9 <br>
row[1] -9 -8 -4 3 8 14 18 21 26 31 34 <br>
row[2] -5 1 2 7 15 16 23 24 26 36 36 <br>
<br>
row[2] -5 1 <br>
<br>
row[2] 1 <br>
<br>
row[0] -7 -7 -1 0 5 6 6 7 9 <br>
row[1] -4 3 8 14 18 21 26 31 34 <br>
<br>
row[1] -4 <br>
<br>
row[0] -7 -1 0 5 6 6 7 9 <br>
<br>
row[0] -1 0 5 6 6 7 9 <br>
<br>
row[0] 0 5 6 6 7 9 <br>
<br>
find it! array[0][14]=0<br>
<br>
find it! at counter/ArraySize=57/20=2.850000<br>
multi test <br>
<br>
find it! array[4][8]=0<br>
<br>
find it! at counter/ArraySize=42/20=2.100000<br>
<br>
find it! array[5][5]=0<br>
<br>
find it! at counter/ArraySize=6/20=0.300000<br>
<br>
find it! array[8][3]=0<br>
<br>
find it! at counter/ArraySize=10/20=0.500000<br>
<br>
find it! array[8][2]=0<br>
<br>
find it! at counter/ArraySize=22/20=1.100000<br>
<br>
find it! array[15][0]=0<br>
<br>
find it! at counter/ArraySize=22/20=1.100000<br>
<br>
find it! array[6][4]=0<br>
<br>
find it! at counter/ArraySize=43/20=2.150000<br>
<br>
find it! array[9][1]=0<br>
<br>
find it! at counter/ArraySize=12/20=0.600000<br>
<br>
No luck! counter/ArraySize=49/20=2.450000<br>
<br>
find it! array[9][1]=0<br>
<br>
find it! at counter/ArraySize=12/20=0.600000<br>
<br>
find it! array[12][0]=0<br>
<br>
find it! at counter/ArraySize=17/20=0.850000<br>
<br>
find it! array[16][0]=0<br>
<br>
find it! at counter/ArraySize=24/20=1.200000<br>
<br>
find it! array[6][4]=0<br>
<br>
find it! at counter/ArraySize=34/20=1.700000<br>
<br>
find it! array[11][1]=0<br>
<br>
find it! at counter/ArraySize=22/20=1.100000<br>
<br>
find it! array[14][0]=0<br>
<br>
find it! at counter/ArraySize=23/20=1.150000<br>
<br>
find it! array[15][1]=0<br>
<br>
find it! at counter/ArraySize=24/20=1.200000<br>
<br>
find it! array[9][1]=0<br>
<br>
find it! at counter/ArraySize=27/20=1.350000<br>
<br>
find it! array[13][0]=0<br>
<br>
find it! at counter/ArraySize=18/20=0.900000<br>
<br>
find it! array[11][1]=0<br>
<br>
find it! at counter/ArraySize=15/20=0.750000<br>
<br>
find it! array[12][0]=0<br>
<br>
find it! at counter/ArraySize=17/20=0.850000<br>
<br>
find it! array[3][11]=0<br>
<br>
find it! at counter/ArraySize=48/20=2.400000<br>
<br>
20 times and average is 1.2175<br>
กก</p>
<pre></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>