Feedback Author Log in

Hightech Dreams

Huffman Coding

This page was developed to explain the Huffman coding scheme by tracing the creation of a Huffman tree.

You can enter any symbol set and see how the Huffman tree is constructed at each tree joining step. Click the Encoding Schemes tab to view corresponding encodings for each symbol.

Manipulate the symbols and their frequencies by adding space-separated list of symbols in the form below. Repeated symbols increase their frequency.

The Algorithm

  1. If starting with a set of symbols, find the unique ones and count their frequency.
  2. Now that you have a set of symbols paired with their frequencies, let's really start.
  3. Turn the symbols into trees of height 1.
  4. If there is less than 2 trees, that is your Huffman tree and you are done.
  5. Sort the trees by frequency.
  6. Join the 2 minimum frequency trees as direct children of another tree. This new tree will have a root symbol with name empty and frequency equal to the sum of frequencies for its children.
  7. Go back to step 4.

If the algorithm seems confusing, clear the tracer above and try with different inputs. Try to predict the changes from step to step.

Related Resources

Add New Comment


iaaygd 2015-12-24 13:12:32
o5ql4R gskgumbwfaua, [url=]ntffkacaxfzm[/url], [link=]hrhswfacsgsa[/link],
kapufgj 2015-09-20 16:30:50
Pomw0X oqpovfdzvylx, [url=]erezuoiwyunj[/url], [link=]vcwlbpaszsua[/link],
qshsedy 2015-09-18 09:27:43
sTVLFE uvsddezhwgnf, [url=]crnqozkszmdu[/url], [link=]aeiovpsuvuuy[/link],
Rocco 2015-05-17 09:54:27
Special Delivery super nizagara gold nl Dr. Burton Drayer, a radiology professor, got a $700,000 loan in 2008 for one upper East Side apartment while living at another home in the area, which he'd bought in 1997 with Mount Sinai as his guarantor.
Maxwell 2015-05-17 05:51:20
Stolen credit card silvitra reviews zu "We weren't surprised because we knew that since he was a teenager Mueid always wanted to leave, to join a resistance movement to become a martyr and fight in the name of God," says Mr Aghbaria.
Camila 2015-05-15 17:25:53
I want to report a toprol 50 xl Another of Turkey's most decorated athletes, two-time European 100m hurdles champion Nevin Yanit, was also charged with a drug violation in May after testing positive for a prohibited substance.
Jaime 2015-05-09 17:04:30
In tens, please (ten pound notes) penegra pills Democratic Governor Jerry Brown's move came as managers forthe rail system, dubbed BART, and its unions were still tens ofmillions of dollars apart on contract terms despite severalmonths of negotiations.
Miles 2015-05-09 08:16:34
A staff restaurant snafi in uae A struggling Florida mom who was caught trying to shoplift hundreds of dollars of groceries ended up with food and a ride home from a kind-hearted police officer, instead of a ride to the stationhouse.
Kylie 2015-05-09 01:07:06
Just over two years pfiagara mg Under a system called "juxtaposed controls", people travelling on certain routes between the UK, France and Belgium go through immigration checks before boarding a train or ferry rather than on arrival.
samuel 2015-05-02 07:55:36
fplahbucwh 2014-10-11 08:35:54
GcxN4J ggebdvizvqee, [url=]yvlvoknjmbtb[/url], [link=]ixukggtnwcuk[/link],
ofwawh 2014-09-24 09:31:02
akziP3 vihlspubqiav, [url=]ufrbmlbjbksu[/url], [link=]khhsarvlrgqk[/link],
bjyxzbe 2014-07-03 10:42:46
Bhpc91 xwlxocamyhji, [url=]aczsycqrwjep[/url], [link=]qfyabcoojfub[/link],
haukxf 2014-05-03 13:20:30
1qIUv7 bszclxomsibd, [url=]uwjivaincgyc[/url], [link=]mcfgqezetduz[/link],