亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? huf_main.c

?? huffman_template_algorithm.zip
?? C
字號:
// ==============================================================
//
//  Copyright (c) 1999-2001 by Alex Vinokur.  This work and all works
//  derived from it may be copied and modified without any
//  restrictions other than that a copy of this copyright notice
//  must be included in any copy of this work or any derived work.
//
// ==============================================================
static char id [] = "@(#)## n-ary Huffman Template Algorithm ## Author : Alex Vinokur ## "__FILE__;

// ##############################################################
// =============================
//  n-ary Huffman Template Algorithm
//  The algorithm (program) contains the following files :
//  - huf_service.H
//  - huf_class.H
//  - huf_methods.H
//  - huf_main.C
// =============================
//
//  FILE : huf_main.C
//
//  AUTHOR : Alex Vinokur
//
//  DESCRIPTION :
//
//         Definition and implementation of the following test classes :
//         ----------------------------------------------
//         - AAA        (non-char) symbol type
//         - BBB        (non-numerical) weight type
//         ----------------------------------------------
//
//         Running the following tests :
//         ----------------------------------------------
//         Test#1.1.  Creating Loaded 5-ary Huffman Tree
//                    from data vector
//                    with char-symbols and int-weights
//
//         Test#1.2.  Encoding and Decoding vector-message
//                    using 5-ary Huffman Tree
//
//         Test#1.3.  Encoding and Decoding string-message
//                    using 5-ary Huffman Tree
//
//         Test#2.    Creating Loaded 24-ary Huffman Tree
//                    from data vector
//                    with char-symbols and int-weights
//
//         Test#3.1.  Creating Loaded Binary Huffman Tree
//                    from data vector
//                    with char-symbols and int-weights
//
//         Test#3.2.  Encoding and Decoding vector-message
//                    using Binary Huffman Tree
//
//         Test#3.3.  Encoding and Decoding string-message
//                    using Binary Huffman Tree
//
//         Test#4.    Creating Dried (Unload) Binary Huffman Tree
//                    from data vector
//                    with int-weights
//                    Note. This vector contains Fibonacci sequence.
//
//         Test#5.    Creating Dried (Unload) Binary Huffman Tree
//                    from data file
//                    with int-weights
//
//         Test#6.    Creating Loaded Binary Huffman Tree
//                    from data file
//                    with char-symbols and int-weights
//
//         Test#7.    Creating Loaded Binary Huffman Tree
//                    from data vector
//                    with string-symbols and float-weights
//
//         Test#8.    Creating Loaded Binary Huffman Tree
//                    from data vector
//                    with AAA-symbols and BBB-weights
//         ----------------------------------------------
//
//  DATE           VERSION
//  ----           -------
//  Aug-26-1999    NHTA 1.0
//  Jul-05-2001    NHTA 1.1
//  Sep-11-2001    NHTA 1.2
//
// ##############################################################


//=======================
#include "huf_methods.H"
//=======================



//###################################################
//############## "Symbols" Test Class ###############
//###################################################
class AAA
{
friend bool operator< (const AAA& inst1_i, const AAA& inst2_i);
friend ostream& operator<< (ostream& o, const AAA& instance_i);
        private :
                static unsigned int     counter_s;
                unsigned int            counter_;
        public :
                AAA () {counter_ = ++counter_s;}
                ~AAA () {}
};

//=========================
ostream& operator<< (ostream& o, const AAA& instance_i)
{
        return o << "AAA_" << instance_i.counter_;
}
//----------------------
bool operator< (const AAA& inst1_i, const AAA& inst2_i)
{
        return (inst1_i.counter_ < inst2_i.counter_);
}




//###################################################
//############## "Weight" Test Class ################
//###################################################
class BBB
{
friend ostream& operator<< (ostream& o, const BBB& instance_i);
friend bool operator< (const BBB& inst1_i, const BBB& inst2_i);
friend bool operator== (const BBB& inst1_i, const BBB& inst2_i);
friend BBB operator* (const BBB& inst1_i, unsigned int int_value_i);
friend BBB operator/ (const BBB& inst1_i, unsigned int int_value_i);
        private :
                int                     value_;
                static unsigned int     counter_s;
                unsigned int            counter_;

        public :
                BBB () {counter_ = ++counter_s; value_ = rand ();}
                ~BBB () {}

                BBB& operator+= (const BBB& inst_i)
                {
                        value_ += inst_i.value_;
                        return (*this);
                }

};

//=========================
ostream& operator<< (ostream& o, const BBB& instance_i)
{
        return o << "BBB_" << instance_i.counter_;
        //#########################################
        // Note! This operator shows bogus weight.
        // Real value (instance_i.value_) hidden.
        //#########################################
}
//----------------------
bool operator< (const BBB& inst1_i, const BBB& inst2_i)
{
        return (inst1_i.value_ < inst2_i.value_);
}
//----------------------
bool operator== (const BBB& inst1_i, const BBB& inst2_i)
{
        return (inst1_i.value_ == inst2_i.value_);
}
//----------------------
BBB operator* (const BBB& inst1_i, unsigned int int_value_i)
{
BBB bbb;
        bbb.value_ = bbb.value_*int_value_i;
        return bbb;
}
//----------------------
BBB operator/ (const BBB& inst1_i, unsigned int int_value_i)
{
BBB bbb;
        bbb.value_ = bbb.value_/int_value_i;
        return bbb;
}



//#####################################################
//=========================
unsigned int    AAA::counter_s (0);
unsigned int    BBB::counter_s (0);
//=========================


//#####################################################
//############# main ##################################
//#####################################################
//==============================
int main (int argc, char **argv)
{

        //===========================================
vector<Cell<char, int> >        data_vector_01;
        for (unsigned char cur_char = 0x20; cur_char < 0x7d; cur_char++)
        {
                data_vector_01.push_back (Cell<char, int> (cur_char, ((cur_char%19 + 3)) * 7));
        }


LoadedHuffmanTree<char, int, 5>         tree_01 (data_vector_01);
        tree_01.showAll ("Test#1.1 : Creating Loaded 5-ary Huffman Tree from <char, int>-data vector");

LoadedHuffmanTree<char, int, 24>        tree_02 (data_vector_01);
        tree_02.showAll ("Test#2 : Creating Loaded 24-ary Huffman Tree from <char, int>-data vector");

LoadedHuffmanTree<char, int>            tree_03 (data_vector_01);
        tree_03.showAll ("Test#3.1 : Creating Loaded Binary Huffman Tree from <char, int>-data vector");

        //=======================================================
vector<char>    vector_source_msg;
vector<CODE>    vector_encoded_msg;
vector<char>    vector_decoded_msg;

string          string_source_msg;
string          string_encoded_msg;
string          string_decoded_msg;


        //============ vector msg ===============================
        cout << endl << "\tTest#1.2 : Encoding and Decoding vector-message using 5-ary Huffman Tree" << endl;

        fill_vector (vector_source_msg, string ("Hi, people! This is vector message from 5-ary Huffman Tree"));

        cout << "Source Message  : " << gstr_vector (vector_source_msg) << endl;

        if (tree_01.encodeMsg (vector_source_msg, vector_encoded_msg))
        {
                cout << "Encoded Message : " << gstr_vector (vector_encoded_msg) << endl;
        }
        else
        {
                cout << "Cannot encode Message <" << gstr_vector (vector_source_msg) << ">" << endl;
        }
        if (tree_01.decodeMsg (vector_encoded_msg, vector_decoded_msg))
        {
                cout << "Decoded Message : " << gstr_vector (vector_decoded_msg) << endl;
        }
        else
        {
                cout << "Cannot decode encoded Message <" << gstr_vector (vector_encoded_msg) << ">" << endl;
        }



        //============ string msg ===============================
        cout << endl << "\tTest#1.3 : Encoding and Decoding string-message using 5-ary Huffman Tree" << endl;

        string_source_msg = "Hi, people! This is string message from 5-ary Huffman Tree";

        cout << "Source Message  : " << string_source_msg << endl;

        if (tree_01.encodeMsg (string_source_msg, string_encoded_msg))
        {
                cout << "Encoded Message : " << string_encoded_msg << endl;
        }
        else
        {
                cout << "Cannot encode Message <" << string_source_msg << ">" << endl;
        }

        if (tree_01.decodeMsg (string_encoded_msg, string_decoded_msg))
        {
                cout << "Decoded Message : " << string_decoded_msg << endl;
        }
        else
        {
                cout << "Cannot decode encoded Message <" << string_encoded_msg << ">" << endl;
        }


        //======================================================
        //============ vector msg ===============================
        cout << endl << "\tTest#3.2 : Encoding and Decoding vector-message using Binary Huffman Tree" << endl;

        fill_vector (vector_source_msg, string ("Hi, people! This is vector message from Binary Huffman Tree"));

        cout << "Source Message  : " << gstr_vector (vector_source_msg) << endl;

        if (tree_03.encodeMsg (vector_source_msg, vector_encoded_msg))
        {
                cout << "Encoded Message : " << gstr_vector (vector_encoded_msg) << endl;
        }
        else
        {
                cout << "Cannot encode Message <" << gstr_vector (vector_source_msg) << ">" << endl;
        }
        if (tree_03.decodeMsg (vector_encoded_msg, vector_decoded_msg))
        {
                cout << "Decoded Message : " << gstr_vector (vector_decoded_msg) << endl;
        }
        else
        {
                cout << "Cannot decode encoded Message <" << gstr_vector (vector_encoded_msg) << ">" << endl;
        }



        //============ string msg ===============================
        cout << endl << "\tTest#3.3 : Encoding and Decoding string-message using Binary Huffman Tree" << endl;

        string_source_msg = "Hi, people! This is string message from Binary Huffman Tree";

        cout << "Source Message  : " << string_source_msg << endl;

        if (tree_03.encodeMsg (string_source_msg, string_encoded_msg))
        {
                cout << "Encoded Message : " << string_encoded_msg << endl;
        }
        else
        {
                cout << "Cannot encode Message <" << string_source_msg << ">" << endl;
        }

        if (tree_03.decodeMsg (string_encoded_msg, string_decoded_msg))
        {
                cout << "Decoded Message : " << string_decoded_msg << endl;
        }
        else
        {
                cout << "Cannot decode encoded Message <" << string_encoded_msg << ">" << endl;
        }




        //==============================================
        //==============================================
        //==============================================
vector<int>     weights_vector_01;
        weights_vector_01.push_back (1);
        weights_vector_01.push_back (1);
const unsigned int      this_start_index = weights_vector_01.size ();
        for (unsigned int the_index = this_start_index;
                          the_index < (this_start_index + 21);
                          the_index++)
        {
                weights_vector_01.push_back (weights_vector_01 [the_index - 2] + weights_vector_01 [the_index - 1]);
        }

DriedHuffmanTree<int>   tree_04 (weights_vector_01);
        tree_04.showAll ("Test#4 : Creating Dried Binary Huffman Tree from <int>-weights vector (Fibonacci sequence)");

DriedHuffmanTree<int>   tree_05 ("weights_file_01");
        tree_05.showAll ("Test#5 : Creating Dried Binary Huffman Tree from <int>-weights file");

LoadedHuffmanTree<char, int>    tree_06 ("data_file_01");
        tree_06.showAll ("Test#6 : Creating Loaded Binary Huffman Tree from <char, int>-data file");


        //===========================================
vector<Cell<string, float> >    data_vector_02;
        data_vector_02.push_back (Cell<string, float> ("a1", 0.0022));
        data_vector_02.push_back (Cell<string, float> ("aa22", 0.002));
        data_vector_02.push_back (Cell<string, float> ("aaa333", 0.02));
        data_vector_02.push_back (Cell<string, float> ("bx1", 0.0001));
        data_vector_02.push_back (Cell<string, float> ("bbyy22", 0.007));
        data_vector_02.push_back (Cell<string, float> ("czzz1", 0.0013));
        data_vector_02.push_back (Cell<string, float> ("cczzzzz22", 0.003));
        data_vector_02.push_back (Cell<string, float> ("ccczzzzzzzz333", 0.023));
LoadedHuffmanTree<string, float>                tree_07 (data_vector_02);
        tree_07.showAll ("Test#7 : Creating Loaded Binary Huffman Tree from <string, float>-data vector");


        //===========================================
vector<Cell<AAA, BBB> > data_vector_03;
        for (unsigned int the_index = 0;
                          the_index < 5;
                          the_index++)
        {
                data_vector_03.push_back (Cell<AAA, BBB> ());
        }
LoadedHuffmanTree<AAA, BBB>             tree_08 (data_vector_03);
        tree_08.showAll ("Test#8 : Creating Loaded Binary Huffman Tree from <AAA, BBB>-data vector");

        return 0;

} // main


//#######################################################
//################ END OF FILE ##########################
//#######################################################

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美一区二区三区四区视频 | 麻豆成人91精品二区三区| 国产精品色婷婷| 国产欧美一区二区三区鸳鸯浴 | 欧美一区二区三区啪啪| 欧洲一区二区av| 欧美日韩三级一区二区| 精品视频全国免费看| 欧美日本一道本在线视频| 精品视频免费在线| 日韩欧美在线一区二区三区| 日韩欧美一级二级三级久久久| 91精品国产综合久久国产大片| 欧美精品v日韩精品v韩国精品v| 欧美精品久久久久久久久老牛影院| 欧美精品一级二级| 久久综合一区二区| 中文字幕一区二区三区精华液| 亚洲人成7777| 日韩国产欧美在线视频| 国产一区美女在线| 成人午夜激情影院| 精品视频在线免费看| 日韩欧美一区二区免费| 精品久久久久久久久久久久包黑料 | 中文字幕第一区第二区| 亚洲精品国产精华液| 免费观看日韩电影| av一区二区三区| 在线电影院国产精品| 久久精品综合网| 亚洲香蕉伊在人在线观| 精品亚洲aⅴ乱码一区二区三区| 国产精品69久久久久水密桃| 91丝袜呻吟高潮美腿白嫩在线观看| 欧美久久一二三四区| 日本一区二区免费在线观看视频| 玉米视频成人免费看| 狠狠狠色丁香婷婷综合激情| 91蜜桃传媒精品久久久一区二区| 欧美一区二区三区男人的天堂 | 99精品1区2区| 欧美v日韩v国产v| 一区二区三区四区在线播放| 麻豆成人av在线| 欧美日韩国产一区| 国产精品免费视频观看| 秋霞成人午夜伦在线观看| 91视频免费观看| 久久久久国产精品人| 五月天久久比比资源色| 91原创在线视频| 久久综合久久综合久久| 日韩制服丝袜av| 在线一区二区观看| 欧美高清在线视频| 美洲天堂一区二卡三卡四卡视频| 欧美在线观看视频一区二区 | 久久久亚洲欧洲日产国码αv| 亚洲成人一区在线| 日本高清免费不卡视频| 欧美激情在线一区二区三区| 激情文学综合插| 日韩亚洲欧美在线观看| 丝袜亚洲另类丝袜在线| 欧美日韩免费不卡视频一区二区三区| 国产精品伦理在线| 成人动漫一区二区三区| 国产精品色婷婷久久58| 福利一区福利二区| 国产午夜精品久久久久久免费视 | 亚洲国产精品成人综合色在线婷婷| 日韩成人精品在线观看| 欧美高清视频一二三区| 日韩电影在线看| 91精品午夜视频| 久久精品久久久精品美女| 欧美一区二区三区在线观看 | 一区二区三区不卡在线观看| 日本久久一区二区三区| 亚洲最大色网站| 欧美午夜片在线观看| 亚洲va韩国va欧美va精品| 欧美日本免费一区二区三区| 天堂久久久久va久久久久| 91精品国产综合久久精品性色| 日韩主播视频在线| 精品福利视频一区二区三区| 国产美女一区二区三区| 国产精品私人自拍| 在线亚洲免费视频| 日日嗨av一区二区三区四区| 欧美va天堂va视频va在线| 激情深爱一区二区| 日韩美女啊v在线免费观看| 色8久久人人97超碰香蕉987| 日产精品久久久久久久性色| 久久中文字幕电影| 色综合天天综合网天天看片| 亚洲成av人片www| 久久五月婷婷丁香社区| 99九九99九九九视频精品| 亚洲va欧美va人人爽午夜| 精品国产污污免费网站入口| 成人免费高清视频| 日韩高清一级片| 国产精品高潮久久久久无| 一本一本大道香蕉久在线精品| 日韩精彩视频在线观看| 国产校园另类小说区| 欧美色精品天天在线观看视频| 久久99精品国产| 亚洲欧洲制服丝袜| 日韩女优电影在线观看| 91丝袜美女网| 久久精品国产在热久久| 亚洲欧美激情视频在线观看一区二区三区 | 蜜臀av国产精品久久久久| 中文字幕中文字幕中文字幕亚洲无线 | 日本一区二区综合亚洲| 精品视频一区二区三区免费| 国产成人鲁色资源国产91色综| 亚洲精品欧美在线| 欧美国产国产综合| 欧美日韩大陆一区二区| 波多野结衣中文字幕一区 | 久久精品国产网站| 亚洲影院在线观看| 中文字幕在线观看不卡| 精品嫩草影院久久| 欧美一区二区三区视频在线 | 亚洲综合丝袜美腿| 欧美激情在线免费观看| 久久只精品国产| 欧美一区二区三区不卡| 在线观看91视频| 91亚洲永久精品| 国产99久久久国产精品潘金| 美女一区二区视频| 视频一区在线播放| 亚洲主播在线观看| 亚洲自拍欧美精品| 一区二区三区波多野结衣在线观看| 国产欧美日韩精品a在线观看| 日韩欧美成人一区二区| 欧美一区二区三区在线电影| 欧美熟乱第一页| 欧美少妇xxx| 91.xcao| 日韩一级视频免费观看在线| 欧美乱妇20p| 51午夜精品国产| 91精品国产综合久久精品| 欧美精品久久久久久久久老牛影院| 欧美在线免费视屏| 欧美网站一区二区| 欧美丰满高潮xxxx喷水动漫| 欧美精品在线观看一区二区| 7777女厕盗摄久久久| 欧美一区二区在线不卡| 日韩欧美黄色影院| 26uuu国产日韩综合| 国产女人18水真多18精品一级做| 国产女主播视频一区二区| 国产片一区二区| 亚洲欧美一区二区久久| 午夜精品久久久久久久99樱桃| 亚洲成人免费在线| 日本成人在线一区| 精品一二三四在线| 成人黄色a**站在线观看| 色综合久久中文字幕| 欧美日韩综合在线免费观看| 欧美日韩精品一区二区| 欧美变态口味重另类| 国产无一区二区| 亚洲综合清纯丝袜自拍| 午夜欧美视频在线观看| 国产中文字幕一区| 97se狠狠狠综合亚洲狠狠| 欧洲精品视频在线观看| 日韩欧美国产综合在线一区二区三区| 久久亚洲二区三区| 亚洲精品写真福利| 麻豆精品一区二区综合av| 丁香五精品蜜臀久久久久99网站| 一本久道久久综合中文字幕| 欧美肥胖老妇做爰| 中文字幕va一区二区三区| 亚洲成在人线免费| 高清国产午夜精品久久久久久| 91丝袜高跟美女视频| 欧美成人精品高清在线播放| 亚洲人123区| 国产米奇在线777精品观看| 欧美日韩国产一级二级| 国产精品色在线| 毛片一区二区三区| 在线免费精品视频| 久久久精品欧美丰满|