You are viewing a single comment's thread. Return to all comments →
int* countingSort(int arr_count, int* arr, int* result_count) { static int res_map[100] = {0}; *result_count = 0; for (int i = 0; i<arr_count; i++){ res_map[arr[i]] ++; } for (int i = 0; i<100; i++){ if (res_map[i] != 0){ for (int j = 0; j<res_map[i]; j++){ arr[(*result_count)] = i; (*result_count)++; } } } return arr; }
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 →