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 reply to Re: Efficient selection mechanism?
by Corion
in thread Efficient selection mechanism?
by BrowserUk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |