Question
C++ question on the function below that I am struggling to write. All help is appreciated. I have the code I have written so far
C++ question on the function below that I am struggling to write. All help is appreciated. I have the code I have written so far under the question which has a function named getFreq that takes a file with characters and updates an array of how many times each character is read in the file. Any method in completing the below function is allowed.
#include
bool die(const string & msg); void getFreq(unsigned long long freq[256], const string & fileName); int main() { unsigned long long freq[256];//array to store frequency char fname[100];//array to read a file name cout > fname; //filename from user getFreq(freq, fname);//call to the function } bool die(const string & msg) { cout
*/ //outputs frequencies for all characters in ascii table
cout Write function named huffman: void huffman(string code[256], const unsigned long long freq[256l); On entry, code is ug (unpredictable garbage). huffman's job is to set each string of code so that code represents an optimal Huffman code. (There's more than one correct code, because there's generally a tie for what's optimal.) For chars that don't appear in the file (so the freq element is 0), just set the corresponding string to the empty string:"" Write a main that passes file name to getFreq, passes the freq arry to huffiman, and outputs the Huffman code
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started