CS301 Data Structures Assignment 4 Solution Spring 2014

Mr. Hamid and Mr. Nisar are working as Detective in an investigation unit of a sensitive institution. They are assigned a very important and complex case to solve. Being an IT professional, you are assigned to help them in anyway. Mr. Hamid has to go outstation in search of a clue. He has found some important points and wants to send them to Nisar via email. Now as the secrecy is the base of the investigation, he has used the code words for the message. The file size is huge. Mr. Hamid wants to send the file as quickly as possible. The heavy files take more time for transmission than small ones. He wants you to compress the message so it can be send rapidly. Suppose the message is;
Deer is dear but dear

How will you encode this message using Huffman encoding for Mr. Nisar?
You are required to show the frequency table, Huffman tree and the encoded message.

Solution:

Deer is dear but dear

size:               21 characters (space)

Letters :         Frequency

SP   :             4

a     :              2

b     :              1

d     :              3

e     :              4

r    :              3

h    :              1

I     :              1

S     :              1

T     :              1

hoffman

Hoffman code table

Character

Code

SP

111

e

110

d

000

R

001

A

01

I

10000

S

10001

B

10010

U

10011

t

101

 

DOWNLOAD SOLUTION HERE
loading...