Huffman Code

In this assigment, you need some text files. Click HERE to download some.

In this assignment, you are to implement the Fixed-length Huffman coding that we learn in the class. You should perform the following:

1- Huffman Encoder.

 a. This is a C++ program that reads as input a text file. The file is read character by character and count the number of unique characters.

b. Translate the number of unique characters into Binary and check the number of bits required.

c. Based on this number, provide a unique code for each occurance in the characters.

d. Start encoding the text file using the codes.

e. Save the code table as well as the encoded text file.
  1. Huffman Decoder

    a. This is a C++ program that reads as input the code table and the encoded text file generated from 1 above.

    b. The encoded input file must in binary.

    c. Read the code words from the file and decode them to the designated character from the code table.

    d. The output must be the same text file that was read in step 1.

Edited by mohammad.alsheyab: updating

5 Years
Discussion Span
Last Post by Ezzaral

which part of that don't you understand? Were you paying attention in class when your teacher explained it to you?

Edited by Ancient Dragon

Votes + Comments
Like your new avatar AD! :-)

I was in the hospita cause i was very sick and my teacher didn't understand my status
and i didn't know and how can i solve this assignment


First, read the rules about showing effort on homework assignments. Then post what you have so far and specific questions about what you are having trouble with.

Edited by Ezzaral

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.