文件名称:哎呀
介绍说明--下载内容均来自于网络,请自行研究使用
设计一个哈夫曼编码、译码系统。对一个ASCII编码的文本文件中的字符进行哈夫曼编码,生成编码文件;反过来,可将编码文件译码还原为一个文本文件。
(1)从文件中读入任意一篇英文短文(文件为ASCII编码,扩展名为txt);
(2)统计并输出不同字符在文章中出现的频率(空格、换行、标点等也按字符处理);
(3)根据字符频率构造哈夫曼树,并给出每个字符的哈夫曼编码;
(4)图形化输出哈夫曼树、哈夫曼编码;
(5)将文本文件利用哈夫曼树进行编码,存储成压缩文件(编码文件后缀名.huf)
(6)用哈夫曼编码来存储文件,并和输入文本文件大小进行比较,计算文件压缩率;
(7)进行译码,将huf文件译码为ASCII编码的txt文件,与原txt文件进行比较。(Design a Huffman coding and decoding system. Encoding the characters in an ascii - encoded text file, generating the encoding file; In turn, the encoded file decoding can be restored to a text file.
( 1 ) read any English short passage from the file ( the file is ascii and the extension is txt );
( 2 ) statistics and output the frequency of different characters in the article ( space, line breaks, punctuation, etc. also by character );
( 3 ) Huffman tree is constructed according to the character frequency, and Huffman coding of each character is given.
( 4 ) graphic output Huffman tree, Huffman coding;
( 5 ) the text file is encoded using Huffman tree and stored as compressed file ( encoded file suffix. huf )
( 6 ) the Huffman coding is used to store the file, and compared with the input text file size, the compression ratio of the file is calculated.
( 7 ) decode, decode the huf file into ascii - encoded txt file, and compare it with the original txt file.)
(1)从文件中读入任意一篇英文短文(文件为ASCII编码,扩展名为txt);
(2)统计并输出不同字符在文章中出现的频率(空格、换行、标点等也按字符处理);
(3)根据字符频率构造哈夫曼树,并给出每个字符的哈夫曼编码;
(4)图形化输出哈夫曼树、哈夫曼编码;
(5)将文本文件利用哈夫曼树进行编码,存储成压缩文件(编码文件后缀名.huf)
(6)用哈夫曼编码来存储文件,并和输入文本文件大小进行比较,计算文件压缩率;
(7)进行译码,将huf文件译码为ASCII编码的txt文件,与原txt文件进行比较。(Design a Huffman coding and decoding system. Encoding the characters in an ascii - encoded text file, generating the encoding file; In turn, the encoded file decoding can be restored to a text file.
( 1 ) read any English short passage from the file ( the file is ascii and the extension is txt );
( 2 ) statistics and output the frequency of different characters in the article ( space, line breaks, punctuation, etc. also by character );
( 3 ) Huffman tree is constructed according to the character frequency, and Huffman coding of each character is given.
( 4 ) graphic output Huffman tree, Huffman coding;
( 5 ) the text file is encoded using Huffman tree and stored as compressed file ( encoded file suffix. huf )
( 6 ) the Huffman coding is used to store the file, and compared with the input text file size, the compression ratio of the file is calculated.
( 7 ) decode, decode the huf file into ascii - encoded txt file, and compare it with the original txt file.)
(系统自动生成,下载前可以参看下载内容)
下载文件列表
哎呀\未命名1.cpp
哎呀
哎呀