哈夫曼编码
代码说明:
(1)、I:初始化(Initialization)。从终端读入字符集大小n,以及n个字符和n个权值,建立哈夫曼树,并将它存于文件hfmTree中。 (2)、E:编码(Encoding)。利用以建好的哈夫曼树(如不在内存,则从文件hfmTree中读入),对文件ToBeTran中的正文进行编码,然后将结果存入文件CodeFile中。 (3)、D:译码(Decoding)。利用已建好的哈夫曼树将文件CodeFile中的代码进行译码,结果存入文件TextFile中。 (4)、P:印代码文件(Print)。将文件CodeFile以紧凑格式显示在终端上,每行50个代码。同时将此字符形式的编码文件写入文件CodePrin中。 (5)、T:印哈夫曼树(Tree printing)。将已在内存中的哈夫曼树以直观的方式(树或凹入表形式)显示在终端上,同时将此字符形式的哈夫曼树写入文件TreePrint中((1), I: initialization (Initialization). From the terminal to read the character set size n, as well as n characters and N weights, build Huffman tree and save it in file hfmTree. (2), E: Code (Encoding). Using the built Huffman tree (if not in memory, read from the file hfmTree), the text in the file ToBeTran is encoded, and the result is stored in the file CodeFile. (3), D: decoding (Decoding). Using the built Huffman tree to decode the code in file CodeFile, the result is stored in file TextFile. (4), P: printed code file (Print). The file CodeFile is displayed in a compact format on the terminal, with 50 codes per line. At the same time, the encoding file of this character form is written to file CodePrin. (5), T: Tree printing. The Hoffman tree, already in memory, is displayed on the terminal in an intuitive way (tree or concave form), and the Hoffman tree of this character is written into the file TreePrint.)
文件列表:
哈夫曼编码.docx, 173364 , 2018-06-05
下载说明:请别用迅雷下载,失败请重下,重下不扣分!