This might be what you're after.... not 100% sure as just passing through the thread.
It's always worth Googling for Java solutions to these problems. This code took 2min to transpose from Java to C#
My apologise if I've misunderstood what people are after.
public static int GetLavenshteinDistance(string s, string t) {
if (String.IsNullOrEmpty(s) || String.IsNullOrEmpty(t)) throw new ArgumentException("The strings must not be null.");
/*
* Ported from a Java algorithm by Chas Emerick
* <a rel="nofollow" href="http://www.merriampark.com/ldjava.htm" target="_blank">http://www.merriampark.com/ldjava.htm</a>
*
*/
int n = s.Length;
int m = t.Length;
if (n == 0) {
return m;
} else if (m == 0) {
return n;
}
int[] p = new int[n + 1];
int[] d = new int[n + 1];
int[] _d;
char t_j;
int cost;
for (int i = 0; i <= n; i++) {
p[i] = i;
}
for (int j = 1; j <= m; j++) {
t_j = t[j - 1];
d[0] = j;
for (int i = 1; i <= n; i++) {
cost = (s[i - 1] == t_j) ? 0 : 1;
d[i] = Math.Min(Math.Min(d[i - 1] + 1, p[i] + 1), p[i - 1] + cost);
}
_d = p;
p = d;
d = _d;
}
return p[n];
}