CSharp Clustering Algorithm