Content deleted Content added
→Code Sample in C#: Fixed type |
No edit summary |
||
Line 87:
</source>
==Code Sample in Java==
<source lang="java">
public int runTest(int[] array) {
int[] b = new int[array.length];
int[] c = new int[array.length];
int[] t = new int[array.length];
b[0]=1;
c[0]=1;
int n=0;
int l=0;
int m=-1;
for (n=0;n<array.length;n++) {
int d=0;
for (int i=0;i<=l;i++) d=d^(c[i]*array[n-i]);
if (d==1) {
t=c.clone();
for (int j=0;j<array.length-n+m-1;j++) c[n-m+j]=c[n-m+j]^b[j];
if (l<=n/2) {
l=n+1-l;
m=n;
b=t.clone();
}
}
}
return l;
}
</source>
==See also==
* [[Reeds-Sloane algorithm]], an extension for sequences over integers mod ''n''
|