桶排序
1 # include <iostream> 2 # include <cstring> 3 using namespace std; 4 int main() 5 { 6 int i, j, a[200], n, k; 7 memset(a,0,sizeof(a)); 8 cin>>n; 9 for(i=1;i<=n;i++) 10 { 11 cin>>k; 12 a[k]++; 13 } 14 for(i=0;i<=100;i++) 15 while(a[i]>0) 16 { 17 cout<<i<<" "; 18 a[i]--; 19 } 20 cout<<endl; 21 }