Please check whats wrong in this code
PLEASE CHECK IT ONCE!!
@sneha23 Please mention the question name.
The link which you have shared does not contain the code of “Counting Sort”
sorry here is the code
Your code gives segmentation fault because of line 13. When i=0 count[i-1] will point to a negative index which will segmentation fault.Also you have to initialize the count array with 0 int count[k+1]={};
Your count sort approach is not correct. Count sort is a linear time sorting algorithm. You do not have to sort the complete array using custom sort as you have done in line 36.
Refer to this implementation https://ide.codingblocks.com/s/347204