Pages

CS301 ASSIGNMENT NO. 2 SPRING 2022 || 100% RIGHT SOLUTION || DATA STRUCTURES || BY VuTech

CS301 ASSIGNMENT NO. 2 SPRING 2022 || 100% RIGHT SOLUTION || DATA STRUCTURES  || BY VuTech

CS301 ASSIGNMENT NO. 2 SPRING 2022

CS301 ASSIGNMENT NO. 2 SPRING 2022 || 100% RIGHT SOLUTION || DATA STRUCTURES || BY VuTech


CS301

DATA STRUCTURES

ASSIGNMENT NO. 2

SPRING 2022

LAST DATE: 11-08-2022

SOLUTION:

1: Count all the letters including space from the given text message.

Answer:          Total 52 characters

2: Draw a table with column names (letter, frequency, original bits, encoded bits)

Answer: Mention in 3rd Step.

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).

Answer:

KINDLY, DON’T COPY PASTE

SUBSCRIBE, SHARE, LIKE AND COMMENTS FOR MORE UPDATES

SEND WHATSAPP OR E-MAIL FOR ANY QUERY

0325-6644800

kamranhameedvu@gmail.com

Letter

Frequency

Original Bits

Encoded Bits

Space

10

00100000

01

n

6

01101110

000

o

6

01101111

001

a

5

01100001

1010

e

4

01100101

1100

t

3

01110100

1111

i

3

01101001

1101

u

2

01110101

11101

c

2

01100011

1000

y

2

01111001

10011

d

1

01100100

100100

s

1

01110011

1011001

h

1

01101000

101110

g

1

01100111

111000

k

1

01101011

101111

w

1

01110111

111001

f

1

01100110

1011000

r

1

01110010

101101

m

1

01101101

100101

 

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).

Answer:          You can make Tree by using Shapes in Insert tab of MS Word.

5: Get the encoded bits from tree and fill code of each letter in last column of table constructed in step 2.

6: Calculate the efficiency of Huffman encoding technique.

(For efficiency use total original bits, total compressed (encoded) bits and find what percentage of memory is saved with the help of Huffman encoding technique).

Answer:

A total of 93 bits are required when using the Huffman coding method. Whereas if we send the original message, the total number of characters is 52, each bit requires 8 bits. So, it will take 52 * 8 = 416 bits to send the original message. This number of bits is 77% less than the number of bits in the ASCII encoding form.

7: For the calculation of bandwidth saved for 10,000 messages, use the calculation performed in step 6.

Answer:

For Message 10000 students we can use only 33% of total bandwidth and we can save 77% bandwidth.

For 10,000 messages, only 3300 messages of bandwidth will be required.

KINDLY, DON’T COPY PASTE

SUBSCRIBE, SHARE, LIKE AND COMMENTS FOR MORE UPDATES

SEND WHATSAPP OR E-MAIL FOR ANY QUERY

0325-6644800

kamranhameedvu@gmail.com