Please help me with my assigment
In the given code we are using two classes and two functions. The first class HeapNode_Min will consist of data members and a constructor. The second class Analyze will consist of a function which will compare two heap nodes and will return the result. We are also using display function to print the codes of Huffman tree from the root. HCodes function is used to build a Huffman tree, this function is using two while loops and at the end it calls display_Codes function. In main function we are using two arrays, one for frequency and the second one for alphabets. We are using size_of variable to store the size of data types after their division. At the end of the main function we will call HCodes function.
#include
using namespace std;
class HeapNode_Min { // Tree node of Huffman
public:
//Add data members here.
HeapNode_Min(char d, unsigned f)
{
//Complete the body of HeapNode_Min function
}
};
class Analyze { // two heap nodes comparison
public:
bool operator()(HeapNode_Min* l, HeapNode_Min* r)
{
(l->f > r->f); //Complete this statement
}
};
void display_Codes(HeapNode_Min* root, string s) // To print codes of huffman tree from the root.
{
if (!root)
return;
if (root->d != '