Question: // Generate the frequency table for the Huffman algorithm (WRITING ONLY) // NOTE: mFrequencyTable is an array of 257 unsigned ints representing the count of

// Generate the frequency table for the Huffman
// Generate the frequency table for the Huffman algorithm (WRITING ONLY) // NOTE: mFrequencyTable is an array of 257 unsigned ints representing the count of each character in the file ( the index in the array is the char's ASCII value) Example : "'A' is ASCII 65, 50 if A is the character being checked, [65] of your array would get incremented [256] of your array is the total count of characters in the file void GenerateFrequencyTable( ) // 1. open the file in binary mode ifstream file (mFileName, ios_base: :binary) ; // 2. Get the total count of the file (This can also be done in the next step instead) int filesize = 0; // 3. Read the file one byte at a time, and increment the corresponding index file . seekg(0, ios_base: : end) ; filesize = (int)file. tellg(); file. seekg(0, ios_base: :beg) ; mFrequencyTable [256] = filesize; for (int i = 0; i

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 Mathematics Questions!