Sorting algorithms/Counting sort: Difference between revisions

Content deleted Content added
Rdm (talk | contribs)
J: alternate implementation
Rdm (talk | contribs)
Line 598: Line 598:
<lang J>csort=: (+/@(=/) # ]) >./ (] + 1 i.@+ -) <./</lang>
<lang J>csort=: (+/@(=/) # ]) >./ (] + 1 i.@+ -) <./</lang>


And note that this can be simplified if the range is known in advance.
And note that this can be simplified if the range is known in advance (which would probably be the case -- this sorting mechanism is practical when we have a small fixed range of values that we are sorting.


'''Example:'''
'''Example:'''