Application of Huffman tree :
1. Select an article First
2. Then count the number of characters
3, the number is not 0 characters to encode
4. Output code text
5, the decoding
On-Machine code:
/*************************************************************************> File Name:huffman tree application. cpp > Author:zzuspy> Mail: [email protected] > Created time:2014 December 3 14:30 *********************************** /#include <cstdio> #include <cstring> #include <iostream># Include <algorithm> #include <cstdlib> #include <cmath> #include <stack> #include <queue> #define LL Long Long#define max3 (a,b,c) max (A,max (b,c)) #define MIN3 (a,b,c) min (a,min (b,c)) using namespace Std;typedef Struct{int weight;int Parent, Lchild, Rchild;} Htnode, *huffmantree;typedef char * * huffmancode;int s1, s2;void Select (huffmantree &ht, int n) {int i, min;for (int i= 1; i<=n; i++) {if (ht[i].parent==0) {min = i;break;}} for (I=1; i<=n; i++) {if (ht[i].weight
Application of Huffman tree (data structure)