Question
Implementation of Huffman Coding in C++. Given functions cannot be removed or be changed, nor can be added external functions. Program must be compiled and
Implementation of Huffman Coding in C++. Given functions cannot be removed or be changed, nor can be added external functions. Program must be compiled and must accept file inputs. Example of inputs are :
Input data | ||||||||||||
a | d | e | h | i | g | o | s | t | c | m | v | b |
40 | 3 | 20 | 1 | 10 | 1 | 5 | 2 | 5 | 1 | 1 | 1 | 10 |
Following are the given Classes and functions.
classHtreeNode{
public:
string chStr;
intprob;
string code;
HtreeNode *left;
HtreeNode *right;
HtreeNode *next;
/*------------------ HtreeNODE Constructor -------------------------*/
HtreeNode(){
this-> left =NULL;
this-> right =NULL;
this-> next =NULL;
}
voidprintNode(){}
};
//************************* HuffmanBinaryTree CLASS *******************************/
classHuffmanBinaryTree {
public:
HtreeNode *listHead;
HtreeNode *root;
/*------------------ HuffmanBinaryTree Constructor -------------------------*/
HuffmanBinaryTree(){
this-> listHead =NULL;
this-> root =NULL;
}
/*------------------ Find a spot -------------------------*/
HtreeNode *findSpot(HtreeNode *spot){
returnspot;
}
/*------------------ Insert function -------------------------*/
voidlistInsert(HtreeNode *listHead, HtreeNode *newNode ){ }
/*------------------ Construt Huffman list -------------------------*/
HtreeNode *constructHuffmanLList(){}
/*------------------ Construct Huffman Binary Tree -------------------------*/
HtreeNode *constructHuffmanBinTree(){}
/*------------------ PreOrder Traversal-------------------------*/
voidpreOrderTraversal(){}
/*------------------ inOrder Traversal-------------------------*/
voidinOrderTraversal(){}
/*------------------ PostOrder Traversal-------------------------*/
voidpostOrderTraversal(){}
/*------------------ Construct Char Code-------------------------*/
voidconstructCharCode(){ }
/*------------------ Check leaf-------------------------*/
boolisLeaf(){}
/*------------------ Print list-------------------------*/
voidprintList(){}
};
//************************* Main function *******************************/
intmain(intargc,constchar* argv[]) {
cout
return0;
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