Using Huffman’s algorithm to construct an optimal binary prefix c

Using Huffman’s algorithm to construct an optimal binary prefix c
|

Using Huffman’s algorithm to construct an optimal binary prefix code for the following letters in the table.

Letters

 c

 e

 i

 r

 s

 t

 x

Probability

0.11

0.21

0.16

0.12

0.15

0.10

0.14

The encoding of the word “text” using the above data is :

A. 00001110001

B. 00001001100

C. 00001101110

D. 00001101000

Please scroll down to see the correct answer and solution guide.

Right Answer is: D

SOLUTION

The code for “text” is :

t : 000

e : 01

x : 101

t : 000

total code : 00001101000