LZW Compression

Final Project: Tufts University COMP150 - Special Topics Data Structures and Algorithms

Implementation

All of the compression/decompression modes (see below) are implemented by subclassing Compressor to provide the required low-level compression implementation. Each class provides both compression and decompression capabilities. The compressor and decompressor use a dictionary implemented as a trie for looking up the codes assigned to sequences of characters, combined with a vector of pointers into the trie for looking up character sequences based on codes.

Compression Modes

The compressor has a couple of compression modes, variants on the basic LZW algorithm. For the purposes of specifying which to use (see notes on running the compressor), each has an abbreviation, given in parentheses below.