Outline



Huffman coding



algorithm for building a Huffman coding tree

  1. make a list of all symbols with their frequencies
  2. sort the list so the symbols with the least frequency are in front
  3. if the list only has one element, the element is the root of the tree and we are done
  4. remove the first two elements from the list and put them into a binary tree
  5. add the frequencies of the two subtrees to give the frequency of this binary tree
  6. insert this tree in the right place in the sorted list
  7. return to step 3



using a Huffman coding tree



compression using Huffman coding



an implementation for Huffman trees



Java types, classes, and interfaces