0
6.2kviews
Explain Shannon-Fano algorithm with an example
1 Answer
0
177views

WORKING STEPS OF SHANNON FANO ALGORITHM

• For a given list of symbols, develop a corresponding list of probabilities or frequency counts so that each symbol’s relative frequency of occurrence is known.

• Sort the lists of symbols according to frequency, with the most frequently occurring symbols at the left and the least common at the right.

• Divide the list into two parts, with the total frequency counts of the left part being as close to the total of the right as possible.

• The left part of the list is assigned the binary digit 0, and the right part is assigned the digit 1. This means that the codes for the symbols in the first part will all start with 0, and the codes in the second part will all start with 1.

• Recursively apply the steps 3 and 4 to each of the two halves, subdividing groups and adding bits to the codes until each symbol has become a corresponding code leaf on the tree.

• Example:

• Symbol: ABCDE

• Count

A 15

B 7

C 6

D 6

E 5

enter image description here

• Symbol: ABCDE

• Code

A 00

B 01

C 10

D 110

E 111

Please log in to add an answer.