Counting Sort 1

  • + 0 comments

    If the range of number in a array is between [0,9], then we can create a count array of size 10, where i'th elements can store the number of times integer i occured in the original array. Lets say we have a array: {7, 2, 7, 1, 5} Then our count will have element count[1] = 1, count [2] = 1, count[5] = 1, count[7] = 2 and other elements of count will be zero. Hope that this will help.