哈夫曼信源编码c语言程序代码(3)
发布时间:2021-06-06
发布时间:2021-06-06
HMC HuffmanCoding(HF HT,HMC HC,unsigned int *w,unsigned int n) { unsigned int i,s1=0,s2=0; HF p; char *cd; unsigned int f,c,start,m; MinCode min; if(n<=1) Error("Code too small!"); m=2*n-1; HT=(HF)malloc((m+1)*sizeof(HTNode)); for(p=HT,i=0;i<=n;i++,p++,w++) { p->weight=*w; p->parent=0; p->lchild=0; p->rchild=0; } for(;i<=m;i++,p++) { p->weight=0; p->parent=0; p->lchild=0; p->rchild=0; } for(i=n+1;i<=m;i++) { min=Select(HT,i-1); s1=min.s1; s2=min.s2;
上一篇:适合做背景音乐总汇集
下一篇:10以内加减法100题多份试题