Write a C++ program which makes a binary tree that generates theHuffman code that can accept 26 letters and 10 digits 0 – 9
Solution
//C++ program to make a binary tree that generates the Huffmancode
//importing headerfiles
#include<iostream>
#include<limits.h> //for INT_MAX (gives max value ofinteger)
using namespace std;
// Structure to store each node in the tree
struct node
{
char value; //stores the corresponding character
char leaf_value; //stores the charactercorresponding to the leaf
int count; //contains the count
node *left; //stores the left subtree
node *right; //storesthe right subtree
};
//smallest function.
//Arguments : List of pointers to nodes and its length
//Return : pointer
OR
OR