⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 huffman.h

📁 数据结构的一些简单算法
💻 H
字号:
//======================================================================
//                               Huffman.h
//======================================================================
#ifndef _Huffman_h_
#define _Huffman_h_

#include "ErrorCode.h"

template <class Type> class BinNode
{
	//data members
	Type Data;
	BinNode<Type> * leftChild ;
	BinNode<Type> * rightChild;
	//constructors
	BinNode(Type * x);
	
	BinNode( BinNode<Type> * left , BinNode<Type> * right );
};


template <class Type> class HuffmanTree
{
	private:
		BinNode<Type> * root;
	public:
		HuffmanTree(Type * HufData);
		HuffmanTree(HuffmanTree<Type> * leftTree , HuffmanTree<Type> * rightTree);
		BinNode<Type>* getRoot();
		int getWeight();
};

template <class Node_entry> struct Node
//the structure of the list entry
{
	//Data members
	Node_entry         entry ; //Node entry
	Node<Node_entry>*  next  ; //Node to next
	//constructors
	Node();
	Node(Node_entry tmpEntry,Node<Node_entry>* link = NULL)
	{
		entry = tmpEntry ;
		next  = link ;
	}
};

template <class list_entry> class list
//class list define
{
public:
	int   count;
	Node<list_entry>*  head;
	
	list();
	list(list<list_entry> &copy) ;
	int size() const { return count; } ;
	int ser_position (list_entry xNode);
	Node<list_entry>*  set_position  (int position)const;
	Error_Code         insert        (int position,const list_entry  &xNode);
	Error_Code		   remove        (list_entry *& xNode);
};

#endif _Huffman_h_

⌨️ 快捷键说明

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