Starting from:

$25

ADS - Huffman’s algorithm - Solved

1           Project 
See the description of this problem in the book for further details.

Write a program that implements Huffman’s algorithm for Data Compression. Please refer to the slides for a description of the algorithm.

Your program should read a (large) text from a file, ideally a text with at least two pages. In the first pass you should build a frequency table for each letter/character, including blank space and punctuation signs.

You should then implement a coding/decoding function, based on the Huffman coding method. The output for the coding phase should be in a file, consisting of a preamble and the encoded version of the text.

The preamble should consist of a sequence of lines of type

<character/symbol><codeword> one for each character/symbol (appearing in the text), followed by a blank

line, then the encoded text.

The decoded file should just print the result of the decoding process.



More products