Answered step by step
Verified Expert Solution
Link Copied!

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 2 functions.
FUNCTION 1:
//create INITIAL huffman "tree"
//put the 26 letters and their fequencies (from counters)
//into the huffman tree, which is just an STL list.
void huffman_enc::setList()
{
}
FUNCTION 2:
// initial "tree" has been created (from setList()),
//create the huffman treeS
//upon completion THE huffman tree is built.
void huffman_enc::makeTrees()
{
}
Files that are provided are:
#include
#include
#include
#include
#include
using namespace std;
#ifndef HUFFMAN_ENC_H__
#define HUFFMAN_ENC_H__
const int howmany =26;//26 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 < n.weight;
}
};
//a huffman_enc tree is just a STL list
//in other words, a huffman tree is just a linked list
class huffman_enc : protected list
{
public:
void getfile();
void setList();
void makeTrees();
void showTrees();
void encode();
private :
int counters[26];//array to hold weights/frequencies of each letter
void inorder(ofstream &,info *,int &);//helper function to read tree,determine code
list code;//list to temporarily store the binary code for an individual letter
char text_filename[60];//name of file containing the message to be encoded
char code_filename[60];//name of file containing the huffman code of each letter
};
#endif

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database 10g Insider Solutions

Authors: Arun R. Kumar, John Kanagaraj, Richard Stroupe

1st Edition

0672327910, 978-0672327919

More Books

Students also viewed these Databases questions

Question

Answer the following: 37Ti/2 in cartesian form x + iy Express z e

Answered: 1 week ago

Question

politeness and modesty, as well as indirectness;

Answered: 1 week ago