defines.h

来自「huffman coding ke yi ce shi jian , you l」· C头文件 代码 · 共 73 行

H
73
字号

#include <vector>
#include <fstream>
#include <iostream>
#include <string>
#include <utility>
using namespace std;


class hNode
{
public:
	unsigned long weight;
	char value;
	bool used;
	vector<hNode>::iterator pLeft;
	vector<hNode>::iterator pRight;
	vector<hNode>::iterator pFront;

	hNode()
	{
		weight = 0;
		value = 0;
		used = false;
		pLeft = NULL;
		pRight = NULL;
		pFront = NULL;
	}

	void Clear()
	{
		weight = 0;
		value = 0;
		used = false;
		pLeft = NULL;
		pRight = NULL;
		pFront = NULL;
	}
/*	hNode(hNode& node)
	{
		weight = node.weight;
		value = node.value;
		used = node.used;
		pLeft = node.pLeft;
		pRight = node.pRight;
		pFront = node.pFront;
	}
	hNode& operator =(hNode& node)
	{
		weight = node.weight;
		value = node.value;
		used = node.used;
		pLeft = node.pLeft;
		pRight = node.pRight;
		pFront = node.pFront;

		return *this;
	}
*/

};

void GatherData(ifstream& inFile, vector<hNode>& hTree);
void CheckData(vector<hNode>& hTree, string ofile);
void CreatHuffmanTree(vector<hNode>& hTree);
vector<hNode>::iterator FindMinimumNode(vector<hNode>& hTree);

void HuffmanCoding(vector<hNode>& hTree, vector<string>& codeResult);

void CheckData(vector<string>& codeResult, string ofile);


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?