Suppose you are given a string “You will receive this message in two days”, Use Huffman Encoding algorithm to create a binary tree with this string.
Solution Guidelines:
In step 1, You have to create a frequency table of characters along with their frequencies.
In step 2: You have to create Binary Tree from letters and their frequencies created in step 1.
/****************** Assignment No. 4 : Solution **********************\
Step 1: Create Frequency table.
Letters | Frequency |
SP | 7 |
A | 2 |
C | 1 |
D | 1 |
E | 5 |
G | 1 |
H | 1 |
I | 4 |
L | 2 |
M | 1 |
N | 1 |
O | 2 |
R | 1 |
S | 4 |
T | 2 |
U | 1 |
V | 1 |
W | 2 |
Y | 2 |
Table 1: Frequency Table
Step 2: Draw Binary tree based on characters and their frequencies given in Table1, which is as follows:
/****************** DOWNLOAD SOLUTION FROM HERE **********************\