Sorting algorithms/Counting sort: Difference between revisions
J: alternate implementation
m (→{{header|REXX}}: corrected a misspelling. -- ~~~~) |
(J: alternate implementation) |
||
Line 593:
cnt # min+i.#cnt
)</lang>
Alternative implementation:
<lang J>csort=: (+/@(=/) # ]) >./ (] + 1 i.@+ -) <./</lang>
And note that this can be simplified if the range is known in advance.
'''Example:'''
<lang j> ] a =. _3 + 20 ?@$ 10
|