Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,13 @@
|
|||
#! /usr/bin/perl
|
||||
use strict;
|
||||
|
||||
sub counting_sort
|
||||
{
|
||||
my ($a, $min, $max) = @_;
|
||||
|
||||
my @cnt = (0) x ($max - $min + 1);
|
||||
$cnt[$_ - $min]++ foreach @$a;
|
||||
|
||||
my $i = $min;
|
||||
@$a = map {($i++) x $_} @cnt;
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
my @ages = map {int(rand(140))} 1 .. 100;
|
||||
|
||||
counting_sort(\@ages, 0, 140);
|
||||
print join("\n", @ages), "\n";
|
||||
Loading…
Add table
Add a link
Reference in a new issue