Please Visit: http://ift.tt/1ajReyV
from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1mN5XZu
via LifeLong Community
Sorting algorithms/Counting sort - Rosetta Code
public static void countingSort(int[] array, int min, int max){
int[] count= new int[max - min + 1];
for(int number : array){
count[number - min]++;
}
int z= 0;
for(int i= min;i <= max;i++){
while(count[i - min] > 0){
array[z]= i;
z++;
count[i - min]--;
}
}
}
http://ift.tt/1povRZK
http://ift.tt/1povQoy
public static void countingSort(int[] array, int min, int max){
int[] count= new int[max - min + 1];
for(int number : array){
count[number - min]++;
}
int z= 0;
for(int i= min;i <= max;i++){
while(count[i - min] > 0){
array[z]= i;
z++;
count[i - min]--;
}
}
}
http://ift.tt/1povRZK
http://ift.tt/1povQoy
from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1mN5XZu
via LifeLong Community
No comments:
Post a Comment