0% found this document useful (0 votes)
239 views4 pages

Dip Part-C PDF

1. The document discusses developing Huffman coding and arithmetic coding for short strings. 2. For the string "COMMITTEE", Huffman coding results in a more compressed encoded string of length 23 bits compared to 27 bits for fixed length coding. 3. Arithmetic coding is developed to code the string "CAB" based on the given character probability table, resulting in a final code range between 0.936 to 0.954.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
239 views4 pages

Dip Part-C PDF

1. The document discusses developing Huffman coding and arithmetic coding for short strings. 2. For the string "COMMITTEE", Huffman coding results in a more compressed encoded string of length 23 bits compared to 27 bits for fixed length coding. 3. Arithmetic coding is developed to code the string "CAB" based on the given character probability table, resulting in a final code range between 0.936 to 0.954.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

PART-C

1. a) Develop the Huffman coding for the word “COMMITTEE” and determine the average length
and efficiency.
Fixed length code
• Consider the message “COMMITTEE” – C, O, M, I, T, E
• Total no. of symbols 9, No. of unique symbols 6.

Symbol Frequency Fixed length code

C 1 000

E 2 001

I 1 010

M 2 011

O 1 100

T 2 101

• Code word for COMMITTEE : 000100011011010101101001001

• Size of the encoded string : 9*3=27 bits.

• Now obtain the Huffman code for the same message (COMMITTEE).

Symbol Probability

C 1/9

E 2/9

I 1/9

M 2/9

O 1/9

T 2/9

Huffman coding procedure

Step 1 : Arrange the symbols in descending order of their probability.


Symbol Probability

E 2/9

M 2/9

T 2/9

C 1/9

I 1/9

O 1/9

Step 2 : Code assignment

Step 3 : Codeword from the Huffman code.

Symbol Probability Codeword Word length

E 2/9 01 2

M 2/9 10 2

T 2/9 11 2

C 1/9 001 3

I 1/9 0000 4

O 1/9 0001 4
• In variable word length:

• Code word for COMMITTEE becomes

• “00100011010000011110101”

• Size of the compressed string : 23 bits

• Therefore 27>23.

OR
b) Develop the Arithmetic coding to code the string “CAB” with the given table.

Solution:

Step 1: Divide the range into 0 – 1.

• First character to be coded : C


• Range is 0.9 – 1 i.e (0.1)
• Code would start in this range only (0.9-1).
• Divided among symbols according to probability.
Cumulative Character Probability table

Character Cumulative Probability

A 0.9+0.6*0.1=0.96

B 0.96+0.3*0.1=0.99

C 0.99+0.1*0.1=1.0

Step 2: Resultant new range is

• Next character is : A
• Range is 0.9 – 0.96 i.e (0.06).

Cumulative Character Probability table

Character Cumulative Probability

A 0.9+0.6*0.06=0.936

B 0.936+0.3*0.06=0.954

C 0.954+0.1*0.06=0.96

Step 3: The resultant range is

• Next character to be coded : B

• Range is 0.936 – 0.954 i.e (0.018).

• Final code for String CAB is in between 0.936 to 0.954.

You might also like