A technique for rearranging an input data stream for LZ data compression
system to achieve a higher data compression. In one example embodiment,
this is achieved by receiving an input data stream of a sequence of data
blocks. Each of the received data blocks is then compared with each of a
predetermined number of previously processed data blocks. One or more
match locations and their associated match lengths for each of the data
blocks are determined as a function of the comparison. An affinity array
is then formed, such that each element in the affinity array comprises an
affinity number based on the one or more match locations and their
associated match lengths. The sequence of data blocks in the input data
stream is then rearranged using the affinity array to form a new data
stream. The new data stream is then encoded to achieve the higher data
compression.