NAMES:

LOGINS:

PRECEPTS:

COS 226 Exercises on Data Compression


References: Section 5.5 in Algorithms, 4th edition

1. Draw the Huffman trie for the following string in a style similar to p. 832 of Algorithms 4; ALSO give the codewords for each of the 5 symbols {E, H, R, T, W}; and give the length (in bits) of the encoded message.

W E W E R E T H E R E W E W E R E H E R E



















2. Give the LZW encoding for the following string using the compress() method of Algorithm 5.11 of Algorithms 4. Use 8-bit codewords and 7-bit chars.

W E W E R E T H E R E W E W E R E H E R E