import java.util.Arrays;
import java.util.LinkedList;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner cin = new Scanner(System.in);
int n = cin.nextInt();
int max = 10000;
int x;
int []count = new int[max+1];
Arrays.fill(count, 0);
for (int i = 0; i < n; i++){
x = cin.nextInt();
count[x]++;
}
boolean flag = false;
for (int i = 0; i <= max; i++){
while (count[i] > 0){
if (!flag){
System.out.print(i);
flag = true;
}else {
System.out.print( " " + i);
}
count[i]--;
}
}
System.out.println();
}
}
Java实现桶排序
最新推荐文章于 2024-08-05 13:37:28 发布