You are viewing a single comment's thread. Return to all comments →
This is the simplest algorithm I used, sharing 'cause I see a lot of twisted answers here in Discussions
(C++)
vector<int> countingSort(vector<int> arr) { vector<int> result(100,0); vector<int> sorted; for(int i=0;i<arr.size();i++) result[arr[i]]++; for(int i=0;i<result.size();i++) while(result[i]--) sorted.push_back(i); return sorted; }
Seems like cookies are disabled on this browser, please enable them to open this website
Counting Sort 2
You are viewing a single comment's thread. Return to all comments →
This is the simplest algorithm I used, sharing 'cause I see a lot of twisted answers here in Discussions
(C++)