English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

How will you code this word MAHARASHTRA.
please explain procedure also.
I know huffman tree theory but I am not able to code given words. Please tell me technique to code the words.

2006-11-09 04:53:56 · 2 answers · asked by Abhijit D 2 in Computers & Internet Programming & Design

2 answers

MAHARASHTRA - start looking for the occurence of the letters
M - 1
A - 4
H - 2
R - 2
S - 1
T - 1

Now, sort them in their occurence priority.

A - 4, H -2, R -2, M -1,S - 1, T -1

Calculate probabailities for them.
A - 4/11, H - 2/11, R - 2/11, M - 1/11, S - 1/11, T - 1/11.

Peak two with the smallest probabiltiy and grab them into one. Here we will grab S and T. The new node will have probability equal to their total.

A - 4/11, H - 2/11. R - 2/11, M - 1/11, New1 - 2/11.

The nest nodes we will peak will be M and New1 as the yhave smallests probabilities.

A - 4/11, H - 2/11, R - 2/11, New2 - 3/11.

H and R.

A - 4/11, New3 - 4/11, New2 - 3/11.

New3 and New2

A - 4/11, New 4 - 7/11.

A and New 4

New5 - 11/11.

So now our tree is ready, which is like
New5 - A, New4
New4 - New3, New2,
New3 - H and R
New 2 - M and New1
New1 - T and S.

Now go one coding them. Left branch zero and right branch one.

Your final coding is -
A - 0
H - 100
R - 101
M - 110
T - 1110
S - 1111

Hope this helps. To make things clear I will get a diagram for you sooner.

2006-11-09 15:29:53 · answer #1 · answered by manoj Ransing 3 · 0 0

http://www.siggraph.org/education/materials/HyperGraph/video/mpeg/mpegfaq/huffman_tutorial.html

2006-11-09 12:59:05 · answer #2 · answered by boris 5 · 0 0

fedest.com, questions and answers