Professional Documents
Culture Documents
Instructions:
Please read the following instructions carefully before solving & submitting assignment:
It should be clear that your assignment will not get any credit (marks) if:
The submitted assignment file is not in “.doc” or “.docx” format.
The submitted assignment file does not open or corrupted.
The assignment is copied (from another student or internet).
Uploading instructions:
Do not wait for grace day. Grace day is given only if there is problem with LMS on due date. Submit
your solution within due date.
It is clearly mentioned to submit your solution only in “.doc/.docx” format. Assignment submitted in any other
format like PDF, CPP, Any Image, Screenshot etc. will get zero marks.
Objective:
You need to perform following step by step tasks to compress the message, calculate the efficiency and find
bandwidth saved for the messages of 10,000 students:
1. Count all the letters including space from the given text message.
I count all the letters including space from the given text message and that are “52” characters.
2. Draw a table with column names (letter, frequency, original bits, encoded bits)
Here I draw a table with the given column names of letter, frequency, original bits, encoded bits.
3. Fill the table with letters, frequency, original bits (for original bits get ASCII decimal code of each letter,
convert the decimal ASCII into 8 bits binary code) and encoded bits (these can be found from Huffman
encoding tree as mentioned in point 5).
4. Draw final Huffman encoding tree with the help of frequency table. (Step by step construction of
Huffman encoding tree is not required, just show the final tree in the solution file).
Here I draw the final Huffman encoding tree with the help of frequency table.
5. Get the encoded bits from tree and fill code of each letter in last column of table constructed in step 2.
I get all the encoded bits from tree and fill code of each letter in last column of table I constructed in step 2 of
the given statements.
Letter Frequency Original Bits Encoded Bits
Space 10 00100000 00
n 6 01101110 100
o 6 01101111 011
a 5 01100001 1111
e 4 01100101 1110
t 3 01110100 0101
i 3 01101001 1010
u 2 01110101 11001
c 2 01100011 10110
y 2 01111001 10111
d 1 01100100 110000
s 1 01110011 110001
h 1 01101000 110110
g 1 01100111 110111
k 1 01101011 110100
w 1 01110111 110101
f 1 01100110 010010
r 1 01110010 010011
m 1 01101101 01000
Using the Huffman encoding method entire 93 bits are required . Whereas if I send the unique message
consist of total characters “52” then each bit requires 8 bits. So there the tangible message will require
52*8 = 416 bits.
No. of bits With ASCII method = numbers of characters * numbers of encoding bits (8)
= 52 * 8
= 416 bits
No. of bits With Huffman method = numbers of frequencies * number of encoded bits
= (10 x 2) + (6 x 3) + (6 x 3) + (5 x 4) + (4 x 4) + (3 x 4) + (3 x 4) + (2 x 5) + (2 x 5) + (2 x 5) + (1 x 6) +
(1 x 6) + (1 x 6) + (1 x 6 )+ (1 x 6) + (1 x 6) + (1 x 6) + (1 x 6) + (1 x 5)
= 20 + 18 + 18 + 20 + 16 + 12 + 12 + 10 + 10 + 10
+6+6+6+6+6+6+6+6+5
= 199bits
7. For the calculation of bandwidth saved for 10,000 messages, use the calculation performed in step 6.
After my conclusion of the previous steps the Calculation of bandwidth saved for 10,000 messages by
using the calculation performed in step 6 the final answer is given below:-
Note:
Consider all the characters/letters are in lower case and new line characters are not used in the message.
Code is not required.
Lectures Covered:
This assignment will cover lectures 16 to 28.
Deadline:
Your assignment must be uploaded/submitted on/before Thursday, August 11, 2022.