Algorithm-Networksort
view release on metacpan or search on metacpan
lib/Algorithm/Networksort.pm view on Meta::CPAN
my $network = $self->network();
#
### sort():
##### $network
##### $array
#
#
# Variable $swaps is a global variable that reports back the
# number of exchanges.
#
$swaps = 0;
for my $comparator (@$network)
{
my($left, $right) = @$comparator;
if (($$array[$left] <=> $$array[$right]) == 1)
{
@$array[$left, $right] = @$array[$right, $left];
( run in 0.567 second using v1.01-cache-2.11-cpan-49f99fa48dc )