Skip to content
Snippets Groups Projects
Commit 5a131ae3 authored by Dinda Yora Islami's avatar Dinda Yora Islami
Browse files

add radix

parent 3bbe6610
No related merge requests found
......@@ -40,13 +40,13 @@ void countSort(int arr[], int n, int exp)
// Change count[i] so that count[i] now contains actual
// position of this digit in output[]
for (i = 1; i < 10; i++)
count[i] += count[i - 1];
h_count[i] += h_count[i - 1];
// Build the output array
for (i = n - 1; i >= 0; i--)
{
output[count[ (arr[i]/exp)%10 ] - 1] = arr[i];
count[ (arr[i]/exp)%10 ]--;
output[h_count[ (arr[i]/exp)%10 ] - 1] = arr[i];
h_count[ (arr[i]/exp)%10 ]--;
}
// Copy the output array to arr[], so that arr[] now
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment