BitVector
From charlesreid1
quick example:
Keeping track of a subset S of a large population of potential objects P,
If our problem conforms to the limitation that the size of S should be roughly the size of P, or that P is a reasonable size, then we can use a bit vector to represent this.
We create an array of booleans, and we represent all the potential Ps as a binary vector. Then each bit is turned on or off, which yields an integer number, which yields an array element.
For example, let's suppose you were keeping track of 5 binary flags, or 32 values. Then we switch different flags, and end up with different values. That is, the binary number 11111 would become index 31 (the last index); 10110 becomes index 22; etc.
Also see this video, about halfway through - Stanford Algorithms lecture: http://openclassroom.stanford.edu/MainFolder/VideoPage.php?course=IntroToAlgorithms&video=CS161L13P1&speed=100