Counting Sort 1

  • + 0 comments
    def countingsort(arr): 
    		res=[0]*100 
    		for i in arr: 
    			res[i]+=1 
    		return res 
    def countingsort(arr): 
    		return [arr.count(i) for i in range(100)] 
    

    First one is better cause you don't have to count the number with zero freq.