哈夫曼樹大实验报告.docVIP

  • 9
  • 0
  • 约 19页
  • 2017-01-20 发布于重庆
  • 举报
哈夫曼樹大实验报告

// 程序名:Huffman.h // 程序功能:输入字符集,生成哈夫曼树,对文件进行编码译码,输出 // 作者:xx // 日期:2009.12.20 // 版本:1.0 //” Huffman.h” #includeiostream.h #includeiomanip.h #includefstream.h struct HuffmanNode { public: int weight;//存放结点的权值,假设只考虑处理权值为整数的情况 int Mark;//标记结点是否被访问过 int parent;//-1表示为根结点,否则表示为非根结点 int lchild,rchild;//分别存放改结点的左,右孩子的所在单元的编号 }; class HuffmanTree { public: int head;//根结点 HuffmanNode *Node;//哈夫曼树中结点的存储结构 char * Info;//用来保存各字符的信息 int LeafNum;//树中的叶子结点总数 void Initialization(int WeightNum);//初始化 void Encoding();//利用构造好的哈夫曼树对字符ch进行编码 void Decoding();

文档评论(0)

1亿VIP精品文档

相关文档