?? huffman.h
字號:
/*
* Copyright (c) 2005,重慶工學院計算機學院
* All rights reserved.
* 文件名稱: huffman.h
* 作 者: 令狐杰
* 完成日期: 2005年10月23日 02:50
*/
#include <stdio.h>
#include <string.h>
#include <iostream.h>
const int maxleng=26;
typedef struct /* 定義一個HUFFNODE結點 */
{
char data;
int weight;
int parent;
int left;
int right;
}huffnode;
typedef struct /* 定義一個HUFFCODE結點 */
{
char cd[maxleng]; /* 數組cd存放哈夫曼編碼 */
int start;
}huffcode;
class huffman
{
public:
huffman();
~huffman();
void getdata(); /* 輸入數據 */
void createhfmtree(); /* 創建一棵哈夫曼樹 */
void disphfcode(); /* 顯示哈夫曼編碼 */
void coding(); /* 編碼函數,給定一個字符串,輸出其對應的哈夫曼編碼 */
void decoding(); /* 譯碼函數,輸入一個代碼流,輸出其對應的字符 */
private:
huffnode *m_ht;
int m_num;
huffcode *m_hcd;
};
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -