[Python] Huffman Coding

Huffman coding implementation in Python

As result:

Symbol    Weight    Huffman Code
          13        111
e         7         001
o         7         010
t         9         110
a         3         0000
f         5         1011
h         4         1000
r         3         0001
g         2         01111
i         2         10010
l         2         10011
n         2         10101
w         1         01100
T         1         011010
b         1         011011
c         1         011100
d         1         011101
m         1         101000
s         1         101001
Advertisements

Tagged: , ,

Leave a Reply :

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: