Generate code, for counting sort, without any function from other libraryes
#include <iostream> #include <vector> using std::cin; using std::cout; using std::vector; using std::max; void countSort(vector<int>& arr) { int n = arr.size(); // The output character array that will have sorted arr vector<int> output(n); // Create a count array to store count of inidividul // characters and initialize count array as 0 vector<int> count(1000, 0); // store count of each character for(int i=0; i<n; ++i) ++count[arr[i]]; // Change count[i] so that count[i] now contains actual // position of this character in output array for (int i=1; i<=1000; ++i) count[i] += count[i-1]; // Build the output character array for (int i = 0; i<n; ++i) { output[count[arr[i