资 源 简 介
哈夫曼树和哈夫曼编码:
从终端输入若干个字符及其对应的整数,将整数作为结点的权值,建立哈夫曼树,然后对各字符进行哈夫曼编码。最后打印哈夫曼树和对应的哈夫曼编码。
设计要求:
⑴ 哈夫曼殊和哈夫曼编码的存储表示参考教材事例
⑵ 在程序中构造四个子程序为
① int createhtree(HTree *t) /*根据输入的字符及其权值建立哈夫曼树*/
② void coding(HTree *t, char *code) /*对哈夫曼树进行编码*/
③ void printhtree(HTree *t, int* path) /*中序打印树*/
④ void printcode(HTree *t) /*输出个字符的哈夫曼编码*/
-Huffman tree and the Huffman coding: input from the terminal a number of characters and their corresponding integer, will be an integer as node weights, the establishment of Huffman tree, and then on the characters Huffman. Finally print Huffman tree and the corresponding Huffman. Design requirements: ⑴ Huffman and Huffman coding is that the reference materials storage ⑵ examples constructed in the procedure for the four subroutines ① int createhtree (HTree* t)/* input characters in accordance with its right value the establishment of Huffman tree*/② void coding (HTree* t, char* code)/* Huffman tree to encode*/③ void printhtree (HTree* t, int* path)/* Pri