北邮数据结构上机实验-哈夫曼树(国外英文资料).docVIP

  • 12
  • 0
  • 约1.24万字
  • 约 30页
  • 2017-06-10 发布于河南
  • 举报

北邮数据结构上机实验-哈夫曼树(国外英文资料).doc

北邮数据结构上机实验-哈夫曼树(国外英文资料)

北邮数据结构上机实验-哈夫曼树(国外英文资料) / * 2.2 topic 2 - applied experiment Use binary tree structure to implement haffman/decoder. Basic requirements: Initialization (Init) : the ability to count the string s of any length in the input, to count the frequency of each character, and to establish the Huffman tree Create a coding table (CreateTable) : code with the already built haffman tree and output each characters code. Encoding (Encoding) : Encoding the input string according to the code table and output the encoded string. Decoding: use the already built haffman tree to decode the encoded string and output the Decoding results. Print (Print) : Print the Huffman tree in an intuitive way Calculate the length of the input string before and after the encoding, and analyze the compression effect of Huffman code. Binary encoding (optional) Test data: I love data Structure, I love Computer. I will try my best to study data Structure. Tip: User interfaces can be designed as menu : they can interact. The frequency of statistics per character in the input string is not present Characters are not encoded. 3 code requirements You must have exception handling, such as dropping an exception when you delete an empty linked list. Maintaining a good style of programming: ? The lines of code and paragraphs should be free and close ? The name of the identifier should be consistent with the meaning of the representation ? The function name should be preceded by a comment indicating the functions function ? The key code should explain its functionality Does the recursive program pay attention to the calling process to prevent the stack overflow? * / # include iostream # include string # include iomanip Using namespace STD. / / static trix list, used to store the haffman tree Struct hnode { Char ss; / / the characters of the nodes Int weight; / / the weight of the node Int the parent; / / parent pointer Int lchild; / / the child pointer Int rchild; / / the child pointer }; / / Huffman code ta

您可能关注的文档

文档评论(0)

1亿VIP精品文档

相关文档