Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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