Bucket sort may be used for many of the same tasks as counting sort, with a like time analysis; however, compared to counting sort, bucket sort necessitates associated lists, dynamic arrays or a large amount of preallocated memory to keep the sets of items within each bucket, whereas counting sort instead stores a individual number (the count of items) per bucket. Because counting sort uses key values as indexes into an array, it is not a comparison sort, and the Ω(n log N) Although radix sorting itself dates back far longer, counting sort, and its application to radix sorting, were both invented by Harold H. Seward in 1954.

COMING SOON!

```
/*
> Counting sort is a sorting technique based on keys between a specific range.
> integer sorting algorithm
> Worst-case performance O(n+k)
> Stabilized by prefix sum array
*/
#include <stdio.h>
#include <string.h>
int main()
{
int i, n, l = 0;
printf("Enter size of array = ");
scanf("%d", &n);
int a[n];
printf("Enter %d elements in array :\n", n);
for(i = 0; i < n; i++)
{
scanf("%d", &a[i]);
if(a[i] > l)
l = a[i];
}
int b[l + 1];
memset(b, 0, (l + 1) * sizeof(b[0]));
for(i = 0; i < n; i++)
b[a[i]]++; //hashing number to array index
for(i = 0; i < (l + 1); i++) //unstable , stabilized by prefix sum array
{
if(b[i] > 0)
{
while(b[i] != 0) //for case when number exists more than once
{
printf("%d ", i);
b[i]--;
}
}
}
return 0;
}
```