用数据结构求哈夫曼树编码?
来源:学生作业帮 编辑:神马作文网作业帮 分类:综合作业 时间:2024/11/12 19:50:02
用数据结构求哈夫曼树编码?
#include
#include
#define OK 1
#define ERROR 0
typedef struct
{
unsigned int weight;
unsigned int parent,lchild,rchild;
}HTNode,*HuffmanTree;
typedef char * * HuffmanCode;
int a[100];
int s1,s2;
int Select()
{
int min,i,sum=0;
min=a[1];
s1=1;
s2=1;
for(i=1;ilchild=0;
p->rchild=0;
}
for(;iweight=0;
p->parent=0;
p->lchild=0;
p->rchild=0;
}
a[0]=n;
for(p=HT+1,i=1;iweight;
for(i=n+1;i
#include
#define OK 1
#define ERROR 0
typedef struct
{
unsigned int weight;
unsigned int parent,lchild,rchild;
}HTNode,*HuffmanTree;
typedef char * * HuffmanCode;
int a[100];
int s1,s2;
int Select()
{
int min,i,sum=0;
min=a[1];
s1=1;
s2=1;
for(i=1;ilchild=0;
p->rchild=0;
}
for(;iweight=0;
p->parent=0;
p->lchild=0;
p->rchild=0;
}
a[0]=n;
for(p=HT+1,i=1;iweight;
for(i=n+1;i