Huffman coding is usually a process helpful to compress files with regard to transmission.

Makes use of statistical coding - more frequently utilized symbols have shorter code words.

Works well with regard to text as well as fax transmissions.

An application which utilizes several data structures.

## Huffman coding:

Reducing strings over arbitrary alphabet ‘Σo’ to be able to strings on the ﬁxed alphabet ‘Σc’ to be able to standardize device operations (‘|Σc|<|Σo|’).

Binary representation related to each operands and operators in machine instructions in computers.

It must be feasible so as to uniquely decode the code-string (string over Σc) to a source-string (string over Σo).

Not every code-string has to correspond to a source-string

Both the actual coding as well as decoding ought to become efﬁcient.

Word: A ﬁnite non-empty string over an alphabet (‘Σo or Σc’).

## Simple Coding Mechanism:

- code(ai) = a non-empty string over Σc, for ai∈Σo.
- code(a1a2…an) = code(a1).code(a2)…code(an).

### Example:

Σ0 =(A, B, C, D, E) and Σc =(0, 1)

A | B | C | D | E | Pefix-property | |
---|---|---|---|---|---|---|

000 | 001 | 010 | 011 | 100 | Code(AAB)=000.000.001, easy to decode | yes |

0 | 01 | 001 | 0001 | 00001 | Code(C)=code(AB)=001, not always possible to uniquely decode | no |

1 | 01 | 001 | 0001 | 00001 | Prefix free code | yes |

1 | 10 | 100 | 1000 | 10000 | Not prefix free code | no |

## Huffman Code Example:

Symbol | A | B | C | D |

Frequency | 13% | 25% | 50% | 12% |

Original Encoding |
00 | 01 | 10 | 11 |

2 bits | 2 bits | 2 bits | 2 bits | |

Huffman Encoding |
110 | 10 | 0 | 111 |

3 bits | 2 bits | 1 bit | 3 bits |

### Expected size:

Original => 1/8x2 + 1/4x2 + 1/2x2 + 1/8x2 = 2 bits / symbol

Huffman => 1/8x3 + 1/4x2 + 1/2x1 + 1/8x3 = 1.75 bits / symbol

### Huffman Coding Example:

E = 01 I = 00 C = 10 A = 111 H = 110 |
Huffman code |

#### Input:- ACE

#### Output:- (111)(10)(01) = 1111001

#### Huffman Coding (coding redundancy):

## The variable-length coding technique:

Symbols tend to be encoded one at a time- (There's a one to one correspondence between source symbols as well as code words)

Optimal code (i.e., minimizes code word length per source symbol).

### Huffman Code Algorithm Overview:

- Encoding.
- Compute frequency associated with symbols in file.
- Generate binary tree which represents best encoding.
- Make use of binary tree in order to encode compressed file- For every symbol, output path through root to leaf as well as Size of encoding = length of path.
- Save binary tree.

### How Myassignmenthelp.net can help students in Huffman Code Algorithm assignments Help?

Myassignmenthelp.net provides basic tips and facts of the Huffman Code Algorithm that help students in understanding the solution of their assignment. Lengthy assignments generally trouble students. So to reduce this stress, we have appointed algorithm professionals to help students understand the basics of algorithm.

Students are also allowed to seek tutorials for the Huffman Code Algorithm from experienced and qualified subject tutors of this online Course Help site. We have 24*7 customer support; so if students have any query related to Huffman Code Algorithm assignment, they can contact us anytime.

Send us your Algorithm assignment, homework or project along with the deadline and we will provide you accurate and quality solutions.