convert psuedo code to C#
for each iteration j
for each instance Insti
for each instance Instk
if(Instk ? Aj-1)
continue;
else
add EuclideanDistance(Insti, Instk) to Listi ;
end
end
calculate percentage of top N instances in Listi
whose label is different from Insti as ?;
if ? = d
Aj = Aj ? Insti;
end
end
if |AjnAj-1| / Max(|Aj|, |Aj-1|)= e
break;
end
end
return Aj