(a) Create a Huffman code for the following string (whitespace
inserted for clarity):
AAA BB CCCCC CCCCC DD EEE
(b) How many bits does your code use to encode the above
string?
(c) Huffman codes are always optimal prefix codes, and there are
many different ways
one can build a Huffman code from the same set of character
frequencies (e.g.
by swapping the left and right subtrees at any iteration). Give an
example of an
optimal prefix code for this text that is not a Huffman code, i.e.,
that cannot be
generated using the Huffman algorithm (Hint: in any Huffman code,
what is the
relationship between the two characters with the lowest
frequencies?).


If you are still having any doubt then please feel free to ask in the comment section.
(a) Create a Huffman code for the following string (whitespace inserted for clarity): AAA BB CCCCC...
For this assignment, you will write a program to work with Huffman encoding. Huffman code is an optimal prefix code, which means no code is the prefix of another code. Most of the code is included. You will need to extend the code to complete three additional methods. In particular, code to actually build the Huffman tree is provided. It uses a data file containing the frequency of occurrence of characters. You will write the following three methods in the...
. Huffman Encoding (a.) (6 points) Suppose a certain file contains only the following letters with the corresponding frequencies 1 AİB 73 9 30 44 130 28 16 In a fixed-length encoding scheme, cach character is given a binary representation with the same number of bits. What is the minimum number of bits required to represent each letter of this file under fixed-length encoding scheme? Describe how to encode all seven letters in this file using the number of bits...
(b.) Huffman code is a way to encode information using variable-length binary strings to represent symbols depending on the frequency of each individual letter. Specifically, letters that appear more frequently can be encoded into strings of shorter lengths, while rarer letters can be turned into longer binary strings. On average, Huffman code is a more efficient way to encode a message as the number of bits in the output string will be shorter than if a fixed-length code was used....