You are viewing a single comment's thread. Return to all comments →
method 1:
vector<int> countingSort(vector<int> arr) { vector<int> freq(100,0); for(int x : arr){ freq[x]++; } return freq; }
method 2:
vector<int> countingSort(vector<int> arr) { vector<int> freq(100,0); int n = arr.size(); for(int i = 0; i < n; i++){ freq[arr[i]]++; } return freq; } ``
Seems like cookies are disabled on this browser, please enable them to open this website
Counting Sort 1
You are viewing a single comment's thread. Return to all comments →
#C++ O(n)
method 1:
method 2: