可以实现哈弗曼编码 和 译码
绝对可靠
#include<stdio.h>
#include<stdlib.h>
#include<malloc.h>
#include<string.h>
typedef struct
{
int weight;
int parent,lchild,rchild;
char info;
}HTNode,*HuffmanTree; //哈夫曼树节点类型
typedef struct
{
char info;
int weight;
}node; //文本字符及其权重节点类型
typedef char ** HuffmanCode;
void Select(HuffmanTree &HT,int n,int *s1,int *s2) //从当前的节点集中选出全中最小的两个节点
{
int i,j,x,y;
for(j=1;j<=n;++j){
if(HT[j].parent==0){
x=j;
break;