Professional Documents
Culture Documents
Spring 2024_CS301_2_BC210404717
Spring 2024_CS301_2_BC210404717
CS301
STUDENT ID BC210404717
STUDENT OF BSCS
QUESTION:
Consider the following string saved into a string type variable. We want to send it over the
network to another computer. Use the given string and answer (solve) the questions given
below.
Answer:
Chara D a t S r u c e s i o n f h B ( C ) p g m Spa .
cter
ce
Frequ 1 3 4 3 6 3 3 5 4 1 6 1 2 1 1 1 1 1 1 1 1 10 1
ency
Numb 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8
er of
Bits
used
witho
ut any
encodi
ng
Huffm
000000
00101
1011
01001
0101
10101
1001
0011
0001
000001
0111
001001
00001
001000
010000
011000
010001
011001
10000
10001
10100
11
10101
an
code
of
each
charac
ter
Numb
er of
Bits
used
1 1 1 2 1 2 2 1 2 1
with 6 6 6 6 6 6 6 6 5 5 5 20 5
5 6 5 4 5 4 0 6 4 0
Huffm
an
encodi
ng
b. Calculate how many bits will be used for the above string:
ANSWER:
Answer:
Answer:
Percentage=((488-267)/488)*100=45.28%