Edit Distance algorithm implementation in C#