You can represent a list of distinct integers no larger than N
using exactly N bits: if the integer i appears in your list, you
set the i th bit to true. Bits for which there is no
corresponding integers are set to false. For example, the
integers 3, 4, 7 can be represented as 00011001. As another
example, the integers 1, 2, 7 can be represented as 01100001.
Bitmaps are great to compute intersections and unions fast. For
example, to compute the union between 3, 4, 7 and 1, 2, 7, all I
need to do is compute the bitwise OR between 00011001 and
01100001 (=01111001) which a computer can do in one CPU cycle.
Similarly, the intersection can be computed as the bitwise AND
between 00011001 and 01100001 (=00000001). Though it does not
necessarily make use of fancy SSE instructions on your desktop,
bitmaps are nevertheless an example of vectorization. That is,
we use the fact that the processor can process several bits with
one instruction. There are some downsides to the bitmap
approach: you first have to construct th