Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: sort with fewest moves

by jlongino (Parson)
on Feb 12, 2002 at 08:33 UTC ( [id://144814]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use strict;
    my @slots;
    ...
    sub build_hash {
      $rlookup{$slots[$_]} = $_ for (0..$max);
    }
    
  2. or download this
    0 2 3 7 6 4 10 5 8 9 1  $empty: 0  move(1, 0);
    2 0 3 7 6 4 10 5 8 9 1  $empty: 1  move(10, 1);
    ...
    Average Moves: 9.33333333333333
    Minimum Moves: 8
    Maximum Moves: 11
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://144814]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-04-25 17:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found