哈夫曼编码

哈夫曼编码,第1张

哈夫曼编码

#include 
#include 
#include 

using namespace std;

struct HTNode
{
    int m_parent;
    int m_lchild;
    int m_rchild;
    int m_weight;
};

struct HTree
{
    HTNode * m_tree;
    int m_num;
};

void InitHTree(HTree &HT, int num)
{
    int total = 2 * num - 1;
    HT.m_tree = new HTNode[total];
    if(!HT.m_tree)
    {
        cout<<"init fail"<>HT.m_tree[i].m_weight;
        HT.m_num++;
    }
    for(; i>num;
    InitHTree(mytree, num);
    showHTree(mytree);
    int pos = mytree.m_num;
    int min1, min2;
    FindTwoMin(mytree,pos,min1,min2);
    cout<<"min1="<>num;
    InitHTree(mytree, num);
    creatHTree(mytree, num);
    char ** code;
    HfCoding(mytree, code);
    showHfCoding(code, num);
}
int main()
{
    //test();
    homework();
    system("pause");
    return 0;
}

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5657717.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-16
下一篇 2022-12-16

发表评论

登录后才能评论

评论列表(0条)

保存