We don't bite newbies here... much | |
PerlMonks |
Re: Efficient selection mechanism?by Corion (Patriarch) |
on Jan 14, 2014 at 14:40 UTC ( [id://1070563]=note: print w/replies, xml ) | Need Help?? |
This is a brute force approach: I would pack the four small integers as bits in a 32-bit integer instead of using an array. Then the problem reduces to scanning that array and checking each bit against the bitmask. If you sort the 32-bit integers, you get a quick way of eliminating half of the search space by looking at the highest bit.
In Section
Seekers of Perl Wisdom
|
|