Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

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,...

1 answer below »

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. Write a program to implement Huffman coding. It should do the following: Accept a text file, possibly of more than one line. Create a Huffman tree for this text file. Create a Huffman code table. Encode the message into binary. You may assume that the messages are written in lower-case letters. The frequency table has 30-lines, where each line contains a letter (or a special character) followed by a space and a positive integer (string of digits). For the simplicity purposes, the only special characters are: `-' for space, `.' for period, `!' for new line, and `+' for end-of-message. Sample input file, together with expected outputs can be found on course website. This project contains three parts, each of which has a different due date: Part 1: Read an input text file, create the frequency table. Part 2: Create the Huffman tree based upon frequency table, the create the Huffman code table based upon the tree. (Difficult) Part 3: Using the Huffman code table to encode the input text file. (Easy) What needs to be submitted: For each part of the project, please submit the source code(s), the readme document file explaining how to run your code, and the sample input/output file that you used to test your code.


Answered 19 days After Apr 12, 2021

Solution

Arun Shankar answered on Apr 14 2021
153 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here