哈夫曼信源编码c语言程序代码(5)
发布时间:2021-06-06
发布时间:2021-06-06
MinCode Select(HF HT,unsigned int n); HF HT=NULL; HuffmanCode HC=NULL; unsigned int *w=NULL; unsigned int i,n; printf("请输入节点个数n:"); scanf("%d",&n); w=(unsigned int *)malloc((n+1)*sizeof(unsigned int *)); w[0]=0; printf("请输入权重:\n"); for(i=1;i<=n;i++) { printf("w[%d]=",i); scanf("%d",&w[i]); } HC=HuffmanCoding(HT,HC,w,n); printf("HMC:\n"); printf("Number\t\tWeight\t\tCode\n"); for(i=1;i<=n;i++) printf("%d\t\t%d\t\t%s\n",i,w[i],HC[i]); } MinCode Select(HF HT,unsigned int n) { unsigned int min,secmin; unsigned int temp; unsigned int i,s1,s2,tempi; MinCode code;
上一篇:适合做背景音乐总汇集
下一篇:10以内加减法100题多份试题