Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^7: Need a faster way to find matches

by kikuchiyo (Monk)
on Jan 18, 2010 at 10:01 UTC ( #817949=note: print w/ replies, xml ) Need Help??


in reply to Re^6: Need a faster way to find matches
in thread Need a faster way to find matches

Yes, I see it now.

I must have misunderstood your condition "do not share any common bits" to mean ~($i1 XOR $i2) instead of $i1 & $i2. For example, the two numbers in the first example do "share" common bits in the sense that both bits are 0. In this case the only valid value for a given $i1 would be ~$i1 and nothing else.

However, if the condition is $i1 & $i2 == 0, then you're right, there are several possible $i2's.

Still, you may be still better off generating the list of possible values for every existing element of the array and check those instead of blindly doing all comparisons.


Comment on Re^7: Need a faster way to find matches

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (19)
As of 2014-07-31 19:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (252 votes), past polls