Sorting algorithms/Counting sort: Difference between revisions
Content added Content deleted
m (made the last sentence in the task's prologue to be a counterexample for the note.) |
|||
Line 1,947: | Line 1,947: | ||
show(`a')</lang> |
show(`a')</lang> |
||
=={{header|Mathematica}}== |
=={{header|Mathematica}}/{{header|Wolfram Language}}== |
||
<lang Mathematica>countingSort[list_] := Module[{minElem, maxElem, count, z, number}, |
<lang Mathematica>countingSort[list_] := Module[{minElem, maxElem, count, z, number}, |
||
minElem = Min[list]; maxElem = Max[list]; |
minElem = Min[list]; maxElem = Max[list]; |
||
Line 1,960: | Line 1,960: | ||
]; |
]; |
||
]</lang> |
]</lang> |
||
<pre>countingSort@{2, 3, 1, 5, 7, 6} |
<pre>countingSort@{2, 3, 1, 5, 7, 6} |
||
->{1, 2, 3, 5, 6, 7}</pre> |
->{1, 2, 3, 5, 6, 7}</pre> |