2011年软件设计师辅导:并行排序算法(7)

2011年软件设计师辅导:并行排序算法(7)
#
Array.Sort(vectors, new VectorComparer2()); #
} #
private static void C(Vector[] vectors) #
{ #
int n = vectors.Length; #
for ( int i = 0 ; i < n; i ++ ) #
{
#
Vector c1 = vectors[i]; #
c1.T = Math.Sqrt(c1.X * c1.X
+ c1.Y * c1.Y #
+ c1.Z * c1.Z
#
+ c1.W * c1.W);
#
}
Array.Sort(vectors, new VectorComparer2());
} #
private static void D(Vector[] vectors)
{ #
int n = vectors.Length;
#
for ( int i = 0 ; i < n; i ++ ) #
{
#
Vector c1 = vectors[i];
#
c1.T = Math.Sqrt(c1.X * c1.X #
+ c1.Y * c1.Y
#
+ c1.Z * c1.Z
+ c1.W * c1.W);
}
#
Sort.ParallelSort < Vector > parallelSort = new Sort.ParallelSort < Vector > (); #
parallelSort.Sort(vectors, new VectorComparer2()); #
} #
}
#
}