freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

數(shù)據(jù)結構課程設計:電文編碼譯碼(哈夫曼編碼)(編輯修改稿)

2025-07-22 07:26 本頁面
 

【文章內(nèi)容簡介】 相同的編號,相同的就輸出這個字符的編碼 { for (k=hcd[j].start。k=n。k++) { code[m]=hcd[j].cd[k]。 //將輸出的編碼賦值到數(shù)組中 m++。 } break。 //輸出完成后跳出當前for循環(huán) } code[m]=39。39。 //把要進行譯碼的字符串存入code數(shù)組中 while(code[0]!=39。39。) for (i=0。in。i++) { m=0。 //m為想同編碼個數(shù)的計數(shù)器 for (k=hcd[i].start,j=0。k=n。k++,j++) //j為記錄所存儲這個字符的編碼個數(shù) { if(code[j]==hcd[i].cd[k]) //當有相同編碼時m值加1 m++。 } if(m==j) //當輸入的字符串與所存儲的編碼字符串個數(shù)相等時則輸出這個的data數(shù)據(jù) { printf(%c,ht[i].data)。 for(x=0。code[xj]!=39。39。x++) //把已經(jīng)使用過的code數(shù)組里的字符串刪除 { code[x]=code[x+j]。 //刪除j個數(shù),往前移動j位 } } } printf(\n)。}⑤主函數(shù)void main(){ char st[MAX],sst[MAX]。 int [257]。 int n,i。printf(請輸入字符串(任意字符):\n)。 gets(st)。 n=jsq(st,sst)。 ///////////////////////////99 for(i=0。i99。i++) sst[i]=st[i]。 //////////////////////////////////HTNode ht[M]。HCode hcd[N]。CreateHT(ht,n,st,)。 CreateHCode(ht,hcd,n)。 outputHCode(ht,hcd,n)。editHCode(ht,hcd,n,sst)。deHCode(ht,hcd,n,sst)。 }五、調(diào)試輸出哈夫曼編碼輸出編碼結果輸出譯碼結果附錄源程序include include //gets()函數(shù)需要define N 256 //義用N表示50葉節(jié)點數(shù)define M 2*N1 //用M表示節(jié)點總數(shù) 當葉節(jié)點數(shù)位n時總節(jié)點數(shù)為2n1define MAX 32767typedef struct{ char data。 //結點字符 int weight。 //權值 int parent。 //雙親結點 int lchild。 //左孩子結點 int rchild。 //右孩子結點}HTNode。/////////////////////////// typedef struct{ char cd[N]。 //存放哈夫曼碼 int start。 //從start開始讀cd中的哈夫曼碼}HCode。///////////////////////////////////int jsq(char *s,int t[],char str[]){char *p。int i,j,k。for(i=1。i=256。i++)t[i]=0。for(p=s。*p!=39。\039。p++){ k=*p。 t[k]++。}j=0。for(i=1,j=0。i=256。i++) if(t[i]!=0) { j++。 }return j。}///////////////////////////////////////////////////void CreateHT(HTNode ht[],int n,char str[],int [])
點擊復制文檔內(nèi)容
環(huán)評公示相關推薦
文庫吧 www.dybbs8.com
備案圖片鄂ICP備17016276號-1