Introduction
Web page :
http://alexvn.freeservers.com/s1/huffman_template_algorithm.html
Download :
http://www.simtel.net/pub/pd/60300.shtml
http://home.barak-online.net/alexvn/s2/hf/hufnta22.zip
The algorithm allows any kind of weights (costs, frequencies), including non-numerical ones. The {0, 1, ..., n-1} alphabet is used to encode message. Built tree is n-ary one.
The algorithm is based on a set of template classes :
- Cell(SYMBOL, WEIGHT),
- Node(SYMBOL, WEIGHT),
- InternalNode(SYMBOL, WEIGHT),
- TerminalNode(SYMBOL, WEIGHT),
- BasicHuffmanTree(SYMBOL, WEIGHT, ARY),
- LoadedHuffmanTree(SYMBOL, WEIGHT, ARITY),
- DriedHuffmanTree(WEIGHT, ARITY).
The user should use only LoadedHuffmanTree and/or DriedHuffmanTree classes.
LoadedHuffmanTree requires (as input data) the symbols and their weights.
DriedHuffmanTree requires (as input data) only the weights.
The program contains the following tests :
* Creating Loaded 5-ary Huffman Tree from data vector with char-symbols and int-weights;
* Creating Loaded 24-ary Huffman Tree from data vector with char-symbols and int-weights;
* Creating Loaded Binary Huffman Tree from data vector with char-symbols and int-weights;
* Creating Dried (Unloaded) Binary Huffman Tree from data vector with int-weights (Fibonacci sequence);
* Creating Dried (Unloaded) Binary Huffman Tree from data file with int-weights;
* Creating Loaded Binary Huffman Tree from data file with char-symbols and int-weights;
* Creating Loaded Binary Huffman Tree from data vector with string-symbols and float-weights;
* Creating Loaded Binary Huffman Tree from data vector with AAA-symbols and BBB-weights;
* Encoding and Decoding vector-message using 5-ary Huffman Tree;
* Encoding and Decoding string-message using 5-ary Huffman Tree;
* Encoding and Decoding vector-message using Binary Huffman Tree;
* Encoding and Decoding string-message using Binary Huffman Tree
Source :
http://groups.google.com/groups?th=f9bb13f7426e888c
Raw run log (Demo) :
http://groups.google.com/groups?th=7daf90d4f66a47ad