Anonymous user
Sorting algorithms/Counting sort: Difference between revisions
→{{header|Python}}
(→{{header|Haskell}}: removed need for scoped type variables) |
|||
Line 429:
True
</lang>
Using a list:
{{works with|Python|2.6}}
<lang python>def countingSort(a, min, max):
cnt = [0] * (max - min + 1)
for x in a:
cnt[x - min] += 1
return [x for x, n in enumerate(cnt, start=min)
for i in xrange(n)]</lang>
=={{header|Smalltalk}}==
|