C语言作业求助

来源:百度知道 编辑:UC知道 时间:2024/06/15 22:21:01
要求

编写哈夫曼编码译码器,实现以下功能:
1) 能对指定的文本文件进行各字符出现频度分析,并建立哈夫曼树与哈夫曼编码,将该文本文件编码成目标文件
2) 对已编码的文件进行解码,还原成原来的文件
需提交:源程序与测试数据与测试结果

老师给的题目就这么多了,劳烦高手帮助

#include<iostream.h>
#include<stdio.h>
#include<stdlib.h>
#include"Queue.h"
struct field {
int coding[10];
char name;
int Weight;
};

const int DefaultSize = 30;
/* 声明“扩充二叉树”的类 */
template <class Type> class ExtBinTree;
//定义“扩充二叉树”的结点
template <class Type> class Element {
friend class ExtBinTree<Type>;
private:
Type data;
char name;
Element<Type> * leftChild, * rightChild;
public:
Element ( ) : leftChild (NULL),
rightChild (NULL) { }
Element ( Type item,char d,
Element<Type> *left = NULL,
Element<Type> *right = NULL ) :
data (item), name(d), leftChild (left), rightChild
(right) { }
void SetData ( const Type& item )
{ data = item; }
void SetName ( const char& item )