diff --git a/algorithms/C/sorting/counting sort.c b/algorithms/C/sorting/counting sort.c new file mode 100644 index 00000000..2bc0df7b --- /dev/null +++ b/algorithms/C/sorting/counting sort.c @@ -0,0 +1,36 @@ +// Counting sort is a stable Sorting Algorithm +#include + +void countSort(int a[],int n,int key) +{ + int count[50]={0}; // assigning all elements as zero + int i,j; + + for(i=0;ikey) + key=a[i]; + } + // calling counting sort + countSort(a,n, key); + return 0; +}