Translating pseudocode to PHP
Posted: Wed Aug 31, 2005 6:20 am
Hi
I have been trying to translate a java pseudocode into a PHP class. The pseudocode code is as follows:
As I am fairly new to PHP I have had difficulty with this. Could anyone please steer me in th eright direction....
Clevie.....
I have been trying to translate a java pseudocode into a PHP class. The pseudocode code is as follows:
Code: Select all
Greedy-String-Tiling(String A, String)
{
tiles = {};
do
{
maxmatch = MinimumMatchLength;
matches = {};
Forall unmarked tokens Aa in A
{
Forall unmarked tokens Bb in B
{
j= 0;
while (Aa+j == Bb+j && unmarked(Aa+j ) && unmarked(Bb+j ))
j ++;
if (j == maxmatch)
matches = matches + match(a, b, j);
else if (j > maxmatch)
{
matches = {match(a; b; j)};
maxmatch = j;
}
}
}
Forall match(a; b; maxmatch) Σ matches
{
For j = 0… (maxmatch - 1)
{
mark(Aa+j );
mark(Bb+j );
}
tiles = tiles U match(a; b; maxmatch);
}
}while (maxmatch > MinimumMatchLength);
return tiles;
}Clevie.....