Question: C + + problem, need help with creating 2 functions. FUNCTION 1 : / / create INITIAL huffman tree / / put the 2 6
C problem, need help with creating functions.
FUNCTION :
create INITIAL huffman "tree"
put the letters and their fequencies from counters
into the huffman tree, which is just an STL list.
void huffmanenc::setList
FUNCTION :
initial "tree" has been created from setList
create the huffman treeS
upon completion THE huffman tree is built.
void huffmanenc::makeTrees
Files that are provided are:
#include
#include
#include
#include
#include
using namespace std;
#ifndef HUFFMANENCH
#define HUFFMANENCH
const int howmany ; letters of alphabet
struct info
char letter;
int weight;holds frequency of each letter in message
info llink, rlink;
bool operator info & n
return weight nweight;
;
a huffmanenc tree is just a STL list
in other words, a huffman tree is just a linked list
class huffmanenc : protected list
public:
void getfile;
void setList;
void makeTrees;
void showTrees;
void encode;
private :
int counters;array to hold weightsfrequencies of each letter
void inorderofstream &info int &;helper function to read tree,determine code
list code;list to temporarily store the binary code for an individual letter
char textfilename;name of file containing the message to be encoded
char codefilename;name of file containing the huffman code of each letter
;
#endif
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
