Counting Sort 1

  • + 0 comments

    Python best solution

    If you’re looking for solutions to the 3-month preparation kit in either Python or Rust, you can find them below: my solutions

    def counting_sort(arr):
        #Time complexity: O(n+k) or just O(n), since k is constant
        #Space complexity (ignoring input): O(k) or just O(1), since k is constant
        frequency_arr = [0]*100
        for number in arr:
            frequency_arr[number] += 1
    
        return frequency_arr