Winner Guy Shechter (j11)

Finish 2003-11-11 10:00:00 UTC

seqfreq

by Scott Norin

Status: Failed
Results: []

Comments
Scott Norin
04 Nov 2003
Randomly determines if there is any elements that are similar to the nearest neighbor.
Please login or create a profile.
Code
function [g] = sf(a,b)
c=[];
for i=1:length(b);
   clear g;
   g(1:b(i)) = [a(i)];
   c=[c g];
end
x=sum(b);
while (((nnz(diff(c))+nnz(diff(fliplr(c)))) < (2*(x-1))))
   r=randperm(x);
   g(1:x)=c(r(1:x));
   c=g;
end