The present invention provides a data compression method in which a
plurality of consecutive characters of a data string to be compressed are
set as a character string to be searched for. Bits of a bit string
representing the set character string are allocated to at least two
codewords. Thus, first and second searching codewords are generated. These
first and second codewords are used as array addresses. First and second
array tables are prepared, in which information on the past occurrence
positions of the set character string is previously entered as the
contents thereof. When the first and second codewords are generated from
the character string to be compressed, the first and second array tables
are looked up by using these codewords as the addresses of the arrays.
When results of looking up these tables match with each other, it is found
that the set character string occurred in the past. Thus, information on
the past occurrence position information of the set character string is
obtained according to the obtained array content. Then, this information
is encoded, so that data compression is performed. Thus, the amount of
memory needed for the tables is significantly reduced, while information
on the past occurrence position of the set character string is obtained
without reducing a searching speed.