问答题
假设用于通讯的电文仅由8个字母A、B、C、D、E、F、G、H组成,字母在电文中出现的频率分别为:0.07,0.19,0.02,0.06,0.32,0.03,0.21,0.10。请为这8个字母设计哈夫曼编码。
【参考答案】
点击查看答案
相关考题
-
填空题
写出下面算法的功能。voidfunction(Bitree*t){if(p!=NULL){function(p->lchild);function(p->rchild);printf(“%d”,p->data);}} -
填空题
写出下面算法的功能。Bitree*function(Bitree*bt){Bitree*t,*t1,*t2;if(bt==NULL)t=NULL;else{t=(Bitree*)malloc(sizeof(Bitree));t->data=bt->data;t1=function(bt->left);t2=function(bt->right);t->left=t2;t->right=t1;}return(t);} -
填空题
函数depth实现返回二叉树的高度,请在空格处将算法补充完整。intdepth(Bitree*t){if(t==NULL)return0;else{hl=depth(t->lchild);hr=());if(())returnhl+1;elsereturnhr+1;}}
