Question: Huffman algorithm using binary trees to create a c or c++ program. Part 1 is to create a codebook using the data from Letters.txt. The

Huffman algorithm using binary trees to create a c or c++ program.

Part 1 is to create a codebook using the data from Letters.txt. The first value is the sample size and the rest are the letters with their corresponding frequencies. Get the code-word for each letter.

Once the Huffman tree is built in part 1, part 2 uses the Huffman tree to translate the binary string in Binary.txt. When a code-word is assigned to a letter, assign a 1 to the left-child (least frequency) and a 0 to the right-child. If both have the same number, assign the first 1 and the second 0.

Part 3: Output the translated binary string and codewords for each letter.

Letters.txt

9 //sample size a 15 //letter, frequency b 7 c 8 d 9 e 20 f 6 g 3 h 12 k 4

Binary.txt

10111000111011101101011011101111

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!