#define_CRT_SECURE_NO_WARNINGS1#include<iostream>#include<stdlib.h>usingnamespace std;voidRadix_sort(int* a,int n){int k =0,max=a[0];for(int i =0; i < n;i++){if(max < a[i])
max = a[i];}while(max){
max /=10;
k++;}int* t =newint[n];int m =1;while(k){int bucket[10]={0};for(int i =0; i < n; i++)
bucket[(a[i]/ m)%10]++;for(int i =1; i <10; i++)
bucket[i]= bucket[i -1]+ bucket[i];for(int i = n -1; i >=0; i--){int c =(a[i]/ m)%10;
t[bucket[c]-1]= a[i];
bucket[c]--;}memcpy(a, t, n*sizeof(int));
m *=10;
k--;}}intmain(){int a[]={144,203,738,905,347,215,836,26,527,602,946,504,219,750,848};Radix_sort(a,sizeof(a)/sizeof(int));for(constauto& e : a)
cout << e <<" ";
cout << endl;return0;}