Counting Sort 2

  • + 0 comments

    We need to print sorted elkements n no. of times as it appears. So we are first counting the no. of times the NUMBER appears between 1 to 100 and then storing (no. of times it appears) in the respective Array index.

    e.g if 3 appears 5 times. We have A[3]=5;

    In that way, we use j index to access sequentially all elements to print them That many times as they appear.