Question: write C + + code.The problem is The program is to compress a file using a Huffman code and to decompress a file generated using
write C code.The problem is
The program is to compress a file using a Huffman code and to decompress a file generated using this code. The program should first read through the file and determine the number of occurrences of each character in the file and the total number of characters in the file. The weight of each character will be the frequency count for that character. The program should then use these weights to construct the Huffman codes for the character in the file. It should then read the file again and encode it using these Huffman codes and generate a file containing this encoded data. The program should also provide the option of decompressing a file that was encoded using this Huffman code. And displaying the huffaman tree
Specification:
Ignore cases and any nonalphabetic characters. Input message file will be terminated by a Your program must be able to read any code table in the correct format.
Conventions
Smaller on left
If alpha chars' frequency is the same, use lexicographical ordering to determine smaller
If alpha and a Tree still smaller on left
If alpha and tree have same frequency, alpha on left
If both trees have the same frequency, lower numbered tree on the left.
Thus, all projects will be generated the same huffman code. Program must ask for file names and run more than once. Program must ask to encode or decode.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
