基数排序算法
public static void radixSort(int[] arr)
{
int index = 0;
int max = arr[0];
for(int i=0;i<arr.length;i++)
{
if(max < arr[i])
max = arr[i];
}
int maxLength = (max+"").length();
int[][] bucket = new int[10][array.length];
int[] counts = new int[10];
for(int i=0,n=1;i<maxLength;i++,n*=10){
for(int j=0;j<arr.length;j++){
int remainder = arr[i] / n %10;
bucket[remainder][counts[remainder]++] = arr[j];
}
}
index = 0;
for(int i=0;i<counts.length;i++){
if(counts[i] != 0 ){
for(int j = 0;j<counts[i];j++){
arr[index++] = bucket[i][j];
}
}
counts[i] = 0;
}
}