Help for this page

Select Code to Download


  1. or download this
    #! perl -slw
    use strict;
    ...
    #swap( [ qw( a b c d e 1 ) ], 5 );
    swap( [ qw( a b c d e f g h i j 1 2 3 4 5 6 7 8 ) ], 10 );
    #swap( [ qw( a b c d e f 1 2 3 ) ], 6 );
    
  2. or download this
    do_swaps: 0 .. 6
    [1 b c d e f a 2 3] 0 <=> 6
    ...
    [1 2 3 a b c d e f] 5 <=> 8
    do_swaps: 6 .. 9
     6 swaps => 1 2 3 a b c d e f
    
  3. or download this
    do_swaps: 0 .. 10
    [1]b c d e f g h i j[a]2 3 4 5 6 7] 0 <=> 10
    ...
    [1 2 3 4 5 6 7 a b c d e f g h i j] 15 <=> 16
    do_swaps: 16 .. 17
    16 swaps => 1 2 3 4 5 6 7 a b c d e f g h i j