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