【正文】
以此同時,這門課程的學習也是非常艱辛的,因為它比較抽象難懂,這需要我們在實踐中不斷的克服。 printf(|^^^^^^^^^^^^^^^^^^^^^^^^^^^**^^^^^^^^^^^^^^^^^^^|\n)。printf(\n)。039。 getchar()。 ht[i].lchild=p1。 inithuffmantree(ht)。j=i。i++) { printf( ……請輸入第[%d]個權值: ,i)。 /*huffmancode是結構數組類型,其0號單元不用,存儲哈夫曼編碼*/void inithuffmantree(huffmantree ht) /*初始化哈夫曼樹函數inithuffmantree()*/{int i。 /*huffmancode是結構數組類型,其0號單元不用,存儲哈夫曼編碼*/功能模塊劃分void main() //主函數void inithuffmantree(huffmantree ht) //初始化哈夫曼樹函數inithuffmantree()void inputweight(huffmantree ht) //輸入權值函數 void selectmin(huffmantree ht, int i, int *p1, int *p2)void createhuffmantree(huffmantree ht) //構造huffman樹,ht[m]為其根結void huffmancodes(huffmantree ht,huffmancode hcd) /*根據huffman樹ht求huffman編開始設置字符數目n輸入權值若輸入=n,輸入字符 N Y輸出編碼數結束 void inithuffmantree(huffmantree ht)void inputweight(huffmantree ht),存放權值最小和次小序號void selectmin(huffmantree ht, int i, int *p1, int *p2)void createhuffmantree(huffmantree ht)void huffmancodes(huffmantree ht,huffmancode hcd) 字符:R S T U V W X Y Z頻度:48 51 80 23 8 18 1 16 10字符: A B C D E F G H I J K L M N O P Q頻度:186 64 13