You are viewing a single comment's thread. Return to all 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.
Seems like cookies are disabled on this browser, please enable them to open this website
Counting Sort 1
You are viewing a single comment's thread. Return to all comments →
First one is better cause you don't have to count the number with zero freq.