sec bit vectors for representing sets figure the bit table for the set of primes in the range to the bit at position is set to if and only if is prime the car on left hit this approach to compression is similar in spirit to ziv-lempel codingwhich is class of coding algorithms commonly used in file compression utilities zivlempel coding will replace repeated occurrences of strings with pointer to the location in the file of the first occurrence of the string the codes are stored in self-organizing list in order to speed up the time required to search for string that has previously been seen bit vectors for representing sets determining whether value is member of particular set is special case of searching for keys in sequence of records thusany of the search methods discussed in this book can be used to check for set membership howeverwe can also take advantage of the restricted circumstances imposed by this problem to develop another representation in the case where the set elements fall within limited key rangewe can represent the set using bit array with bit position allocated for each potential member those members actually in the set store value of in their corresponding bitthose members not in the set store value of in their corresponding bit for exampleconsider the set of primes between and figure shows the corresponding bit table to determine if particular value is primewe simply check the corresponding bit this representation scheme is called bit vector or bitmap the mark array used in several of the graph algorithms of is an example of such set representation if the set fits within single computer wordthen set unionintersectionand difference can be performed by logical bit-wise operations the union of sets and is the bit-wise or function (whose symbol is in javathe intersection of sets and is the bit-wise and function (whose symbol is in javafor exampleif we would like to compute the set of numbers between and that are both prime and odd numberswe need only compute the expression