Programming Assignment 2: Huffman Coding (Due : Nov. 30 (Sunday) 11:59pm)

Write a program to decode a file encoded with the program huffman.c.

huffman.c reads a text file named on the command line and counts all occurences of each of the 255 possible byte combinations in the file in an array called freqs[256]. For example, if there are 14 letter 'A's in the file, then freqs['A'] == 14. The program also counts the number of characters in the file, calling this quantity n. It then builds a Huffman tree from the frequency data. An output file is opened with extension .huf. Before coding the file, the program writes the freq array of 256 integers and the integer n to the output file, using C statements equivalent to:

	fwrite (freqs, 256, sizeof (int), outputfile);
	fwrite (&n, 1, sizeof (int), outputfile);
Then the input file is read again and Huffman coded, and the resulting bits are written to the output file.

Your program should read a Huffman coded input file named on the command line (just like huffman.c), then decode the file, writing it to standard output (i.e. not another file opened with fopen()). You may borrow any code you wish from huffman.c.

Your program should do the following:

Test your program by compressing files with huffman.c and decompressing them with your program.