Monday 1 April 2019

UGC NET Computer Science July 2018 - II Question 25

Question 25
25. A text is made up of the characters A, B, C, D, E each occurring with the probability 0.08, 0.40, 0.25, 0.15 and 0.12 respectively. The optimal coding technique will have the average length of :

Options:
  1. (1) 2.4
  2. (2) 1.87
  3. (3) 3.0
  4. (4) 2.15
Answer : (4) 2.15

Explanation Question 25

Given:
Probability for occurrence of each character in text.
A → 0.08
B → 0.40
C → 0.25
D → 0.15
E → 0.12

Now, we apply the Huffman optimal coding technique.
First we have sort the character by the probability of the occurrence in text.
A → 0.08
E → 0.12
D → 0.15
C → 0.25
B → 0.40

We will draw a Huffman tree:
Tree using Optimal Huffman Coding Technique

Now Huffman coding for character:
A = 1110
B = 0
C = 10
D = 110
E = 1111

Now, length for each character = no of bits * frequency of occurrence:
Length of A = 4 * 0.08 = 0.32
Length of B = 1 * 0.4 = 0.4
Length of C = 2 * 0.25 = 0.5
Length of D = 3 * 0.15 = 0.45
Length of E = 4 * 0.12 = 0.48

Now add these length to find average length:
Average length = 0.32 + 0.4 + 0.5 + 0.45 + 0.48
= 2.15

So, option (4) is correct.


PreviousNext
UGC NET CS 2018 July - II Question 24UGC NET CS 2018 July - II Question 26

No comments:

Post a Comment

UGC NET Computer Science December 2019 | Question 16

Question 16 In a certain coding language. 'AEIOU' is written as 'TNHDZ'. Using the same coding language. 'BFJPV' wil...

Popular Posts