Regarding the counting sort

please explain the counting sort algorithm along with the code

hello @gargshivam2001 in the counting sort we make the for loop run for n times take input the elements ad there we make one frequency array in which we increment at that index equal to element so that we can make a count of that variable for how many times that particular variable has encounteredand sort them according.
like if the array is
5 5 3 8 4 1 3 4
in this we will make the freq array.
at 5th index we will increment it by 1 and then at again at 5th index increment 1 and then same at index 3 and then at index 8 and then index 4 and then index1 and the same for rest fo the elements.
our freq array will be like
0 1 0 2 2 2 0 0 1 .
we will run the for loop till 8 and if the array is freq ARRAY IS NOT 0 AT THAT INDEX THEN THAT INDEX WAS NOT IN THE ARRAY .
BUT IF THAT INDEX IS NOT ZERO THEN THAT ELEMENT WAS THERE IN THE ARRAY FOR THAT FREQ TIMES.

got it
stuck in the code


please help

another code of string sort

hey @gargshivam2001 wait i am sending that.