You are viewing a single comment's thread. Return to all comments →
C++ Solution
void countSort(vector< vector<string> > arr) { int arrSize = arr.size(); int half = arrSize/2; for(int i=0; i<half; i++) { arr[i][1] = "-"; } vector< vector<string> > result(100); for (int j = 0; j < arrSize; j++) { int idx = stoi(arr[j][0]); string res = arr[j][1]; result[idx].push_back(res); } for (size_t i=0; i<result.size(); i++) { vector<string> sub = result[i]; for (size_t j=0; j<sub.size(); j++) { cout << result[i][j] << " " ; } } }
Seems like cookies are disabled on this browser, please enable them to open this website
The Full Counting Sort
You are viewing a single comment's thread. Return to all comments →
C++ Solution