0001 #define _CRT_SECURE_NO_WARNINGS 0002 0003 #include <iostream> 0004 using namespace std; 0005 0006 #include "_share/util.h" 0007 #include "UniPrint/print.h" 0008 0009 #include "huffman_PQ.h" 0010 0011 extern uint32_t* stat(char*, char, char); //根据样本文件统计各字符出现频数 0012 extern HuffForest initForest(uint32_t*); //创建编码树森林 0013 extern HuffTree huffTree(HuffForest&); //构造编码树 0014 extern HuffTable huffCodeTable(HuffTree&); //由编码树转换为编码表 0015 extern int encode(HuffTable&, Bitmap&, char*); //明文的编码,返回编码长度 0016 extern void decode(HuffTree&, Bitmap&, int); //二进制串的解码 0017 0018 struct visit { virtual void operator()(HuffChar& e) { printf("%8d", e.weight); } }; 0019 template <typename T, typename V> void levelorder(BNP<T>, V&);