构造哈夫曼树及输出哈夫曼编码,优先队列构造最小堆实现
Windows下输入结束方法:Enter,Ctrl+Z,Enter
运行结果如下:
#include <fstream>
#include <iostream>
#include <queue>
#include <algorithm>
#include <string>
using namespace std;
typedef struct treeNode {
treeNode * lchild, * rchild;
构造哈夫曼树及输出哈夫曼编码,优先队列构造最小堆实现
Windows下输入结束方法:Enter,Ctrl+Z,Enter
运行结果如下:
#include <fstream>
#include <iostream>
#include <queue>
#include <algorithm>
#include <string>
using namespace std;
typedef struct treeNode {
treeNode * lchild, * rchild;