Sunday, December 27, 2009

Please help with huffman coding technique?

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.Please help with huffman coding technique?
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.Please help with huffman coding technique?
thanks a lot to boris also. Report Abuse

This link shows exactly how it works.


It is easy to understand.


http://www.cs.auckland.ac.nz/software/AlgAnim/huffman.html


Click the ';Run animation at the botttom'; Report Abuse

http://www.siggraph.org/education/materi鈥?/a>

No comments:

Post a Comment