Sorting algorithms/Counting sort: Difference between revisions

Content added Content deleted
m (→‎Icon and Unicon: header simplification)
Line 426: Line 426:
l countingSortInPlace println # ==> list(-4, 1, 2, 3, 5)</lang>
l countingSortInPlace println # ==> list(-4, 1, 2, 3, 5)</lang>


== Icon and Unicon ==
=={{header|Icon}} and {{header|Unicon}}==
==={{header|Icon}}===
The following example is hopefully in the spirit of a counting sort using a hash table as a substituted for a sparse array. Simply translating the pseudo-code would be very un-Iconish (as opposed to Uniconish).
The following example is hopefully in the spirit of a counting sort using a hash table as a substituted for a sparse array. Simply translating the pseudo-code would be very un-Iconish (as opposed to Uniconish).


Line 459: Line 458:
on list : [ 3 14 1 5 9 2 6 3 ]
on list : [ 3 14 1 5 9 2 6 3 ]
with op = &null: [ 1 2 3 3 5 6 9 14 ] (0 ms)</pre>
with op = &null: [ 1 2 3 3 5 6 9 14 ] (0 ms)</pre>

==={{header|Unicon}}===
The Icon solution works in Unicon.


=={{header|J}}==
=={{header|J}}==