算法--计数排序【转】
经典排序算法 - 计数排序Counting sort:http://www.cnblogs.com/kkun/archive/2011/11/23/2260299.html
算法系列-计数排序:http://www.cnblogs.com/eaglet/archive/2010/09/16/1828016.html
计数排序针对已知范围内的数字排序
public static void Sort(int[] A, out int[] B, int k) {
int[] C = new int[k + 1]; B = new int[A.Length]; for (int j = 0; j < A.Length; j++) { C[A[j]]++; } for (int i = 1; i <= k; i++) { C[i] += C[i-1]; } for (int j = A.Length - 1; j >= 0; j--) { B[C[A[j]]-1] = A[j]; C[A[j]]--; } }