Jump to content

Sorting algorithms/Counting sort: Difference between revisions

Added Quackery.
(Added Arturo implementation)
(Added Quackery.)
Line 2,616:
return [x for x, n in enumerate(cnt, start=min)
for i in xrange(n)]</lang>
 
=={{header|Quackery}}==
 
<lang Quackery>
[ 2dup peek 1+
unrot poke ] is [1+] ( [ n --> [ )
[ 1+ dip tuck -
rot 0 swap of
swap rot witheach
[ over +
rot swap [1+]
swap ]
negate swap
[] swap witheach
[ dip over
dip [ i^ + ]
of join ]
nip ] is csort ( [ n n --> [ )
[] 15 times
[ 10 random 10 + join ]
dup say "Before: " echo cr
10 19 csort
say "After: " echo</lang>
 
{{out}}
 
<pre>Before: [ 15 12 15 10 14 15 11 15 11 11 10 13 17 12 10 ]
After: [ 10 10 10 11 11 11 12 12 13 14 15 15 15 15 17 ]</pre>
 
=={{header|R}}==
1,462

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.