Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^3: Need a faster way to find matches

by kikuchiyo (Hermit)
on Jan 17, 2010 at 17:18 UTC ( [id://817881]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my @chopped_array = map { $_ >> 1 } @original_array;
    my %result;
    ...
            $result{ $original_array[$i1] } = $original_array[$i2] unless 
    +$chopped_array[$i1] & $chopped_array[$i2];
        }
    }
    
  2. or download this
    my %hash = map { ($_ >> 1) => 1 } @original_array;
    my %result;
    foreach (keys %hash) {
        $result{($_ << 1) + 1} = ~($_ << 1) if $hash{ ~$_ }; 
    }
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2024-03-28 13:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found