#include#include #include using namespace std;class CountingSort {public: int* countingSort(int* A, int n) { // write code here int* counting = new int[1000]; int* tmp = new int[n]; for(int i = 0; i < n; i++){ tmp[i] = A[i]; } fill(counting, counting+1000, 0); for(int i = 0; i < n; i++){ counting[A[i]]++; } for(int i = 1; i < 1000; i++){ counting[i] += counting[i-1]; } cout<<"counting:"< = 0; j--){ A[counting[tmp[j]]-1] = tmp[j]; counting[tmp[j]]--; } delete [] tmp; delete [] counting; return A; }};int main(){ int a[13] = { 54,35,48,36,27,12,44,44,8,14,26,17,28}; int* res; CountingSort sorter; res = sorter.countingSort(a, 13); cout<<"after sorting:"<