Sorting algorithms/Counting sort: Difference between revisions
Content added Content deleted
(Added Elixir) |
m (→{{header|PHP}}) |
||
Line 1,605: | Line 1,605: | ||
<lang php><?php |
<lang php><?php |
||
function counting_sort($arr, $min, $max) |
function counting_sort(&$arr, $min, $max) |
||
{ |
{ |
||
$count = array(); |
$count = array(); |
||
Line 1,631: | Line 1,631: | ||
array_push($ages, rand(0, 140)); |
array_push($ages, rand(0, 140)); |
||
} |
} |
||
counting_sort( |
counting_sort($ages, 0, 140); |
||
for($i=0; $i < 100; $i++) { |
for($i=0; $i < 100; $i++) { |