CS65: Assignment 1 Mulitmedia Communication Due Date: May 13 To 15
CS65: Assignment 1 Mulitmedia Communication Due Date: May 13 To 15
Mulitmedia Communication
Due Date : May 13 to 15
Huffman coding is a scheme that assigns variable-length bit-codes to characters, such that
the lengths of the codes depend on the frequencies of the characters in a typical message.
As a result, encoded messages take less space (as compared to fixed-length encoding)
since the letters that appear more frequently are assigned shorter codes. This is performed
by first building a Huffman coding tree based on a given set of frequencies. From the tree,
bit-codes for each character are determined and then used to encode a message. The tree
is also used to decode an encoded message as it provides a way to determine which bit
sequences translate back to a character.
Refer to the text for a more detailed discussion on Huffman coding trees.
Assignment:
For this assignment, you will write three programs:
buildtree. Given a file that contains the frequency distribution for all 26 letters of the
alphabet plus four special characters (space, period, new-line, and end-of-message),
buildtree will generate two files: a huffman coding tree file and a file containing bit-code
assignments.
encode. Given the bit-code file generated by buildtree, and a text file containing a
message, encode will produce a binary _le that contains the encoded message.
decode. Given the huffman coding tree file generated by buildtree, and an encoded
message generated by encode, decode will reproduce the original message and output that
message to a text file.