Radix sort vs Counting sort vs Bucket sort. What’s the difference?
Let’s start with some rewriting your code in C, because C more familiar for me to explain. So lets recall your code with some comments: int counting_sort(int a[], int a_len, int maxVal) { int i, j, outPos = 0; int bucket_len = maxVal+1; int bucket[bucket_len]; /* simple bucket structure */ memset(bucket, 0, sizeof(int) * bucket_len); … Read more