{"id":1117,"date":"2009-12-04T12:20:21","date_gmt":"2009-12-04T04:20:21","guid":{"rendered":"http:\/\/www.slyar.com\/blog\/?p=1117"},"modified":"2022-06-22T23:27:01","modified_gmt":"2022-06-23T06:27:01","slug":"huffman-tree-code-c","status":"publish","type":"post","link":"http:\/\/www.slyar.com\/blog\/huffman-tree-code-c.html","title":{"rendered":"C\u7a0b\u5e8f\u5b9e\u8df5 \u54c8\u592b\u66fc(Huffman)\u6811\u4ee3\u7801"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u6587\u7ae0\u4f5c\u8005\uff1a<span style=\"color: #0000ff;\">\u59dc\u5357(Slyar) <\/span>\u6587\u7ae0\u6765\u6e90\uff1aSlyar Home (<a title=\"Slyar\" href=\"http:\/\/www.slyar.com\" target=\"_blank\" rel=\"noopener\">www.slyar.com<\/a>) \u8f6c\u8f7d\u8bf7\u6ce8\u660e\uff0c\u8c22\u8c22\u5408\u4f5c\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5b9e\u9a8c\u8bfe\u5185\u5bb9\u7684\u4ee3\u7801\uff0c\u65e0\u804a\u53d1\u51fa\u6765\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u529f\u80fd\u5305\u62ec\u4ece\u6587\u4ef6\u4e2d\u8bfb\u53d6\u6587\u7ae0\uff0c\u5c06\u6587\u7ae0\u8f6c\u6362\u4e3a\u54c8\u592b\u66fc\u7f16\u7801\uff0c\u5c06\u54c8\u592b\u66fc\u7f16\u7801\u8fd8\u539f\uff0c\u5c31\u662f\u90a3\u51e0\u4e2a\u57fa\u672c\u7b97\u6cd5\u7684\u5b9e\u73b0\u5566\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e3a\u4e86\u65b9\u4fbf\u67e5\u770b\uff0c\u8fd9\u91cc\u8f93\u51fa\u7684\u54c8\u592b\u66fc\u7f16\u7801\u662f1byte\u7684\uff0c\u5176\u5b9e\u771f\u6b63\u5e94\u8be5\u5c06\u5176\u53d8\u4e3a1bit\u5b58\u50a8\uff0c\u8fd9\u6837\u624d\u80fd\u8fbe\u5230\u538b\u7f29\u7684\u76ee\u7684\u3002<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:c decode:true \" >\/*\nSlyar\n2009.10.29\n*\/\n\n#include &lt;stdio.h&gt;\n#include &lt;stdlib.h&gt;\n\n#define N 255\n#define M 2*N - 1\n\n\/* \u8fd0\u884c\u6210\u529f\u6807\u8bb0 *\/\nint ok = 0;\n\n\/* \u4fdd\u5b58\u539f\u6587\u4ef6\u540d *\/\nchar file[20] = {};\n\n\/* \u54c8\u592b\u66fc\u6811\u8282\u70b9\u7c7b\u578b *\/\ntypedef struct\n{\n    int data; \/* \u5b57\u7b26\u503c *\/\n    int weight; \/* \u6743\u91cd *\/\n    int parent; \/* \u53cc\u4eb2\u7ed3\u70b9 *\/\n    int lchild; \/* \u5de6\u5b69\u5b50\u7ed3\u70b9 *\/\n    int rchild; \/* \u53f3\u5b69\u5b50\u7ed3\u70b9 *\/\n}Tree;\n\n\/* \u54c8\u592b\u66fc\u7f16\u7801\u7c7b\u578b *\/\ntypedef struct\n{\n    \/* \u5b58\u653e\u54c8\u592b\u66fc\u7801 *\/\n    char cd[N]; \n    int start;\n}Code;\n\n\/* \u751f\u6210\u8282\u70b9\u53ca\u7f16\u7801\u6570\u7ec4 *\/\nTree ht[M];\nCode hcd[N];\n\n\/* \u51fd\u6570\u58f0\u660e *\/\nint cmp(const void*, const void*);\nint NumberOfChar();\nvoid Reset();\nvoid InputFile();\nvoid Encode(int);\nvoid Decode(int);\nvoid OutputFile(int);\nvoid PrintHuffmanCode(int);\nvoid CreateHT(int);\nvoid CreateHCode(int);\n\n\/* \u4e3b\u51fd\u6570 *\/\nint main()\n{\n    int x = 0;\n    int n = 0;\n    char ch;\n    while(1)\n    {\n        system(\"cls\");\n        printf(\"1. \u8bfb\u5165\u539f\u6587\u4ef6\\n\");\n        printf(\"2. \u5728\u5c4f\u5e55\u4e0a\u6253\u5370\u54c8\u592b\u66fc\u4ee3\u7801\u8868\\n\");\n        printf(\"3. \u7f16\u7801\u539f\u6587\u4ef6\\n\");\n        printf(\"4. \u89e3\u7801\u539f\u6587\u4ef6\\n\");\n        printf(\"5. \u9000\u51fa\\n\");\n        printf(\"Input 1-5:\");\n        \n        scanf(\"%d\", &amp;x);\n        \n        switch(x)\n        {\n            case 1:\n                Reset();\n                InputFile();\n                if (ok)\n                {\n                    \/* \u6392\u5e8f\u4f7f\u5f97\u6709\u6548\u5b57\u7b26\u5728\u524d\u9762 *\/\n                    qsort(ht, N, sizeof(Tree), cmp);\n                    \/* \u8bb0\u4e0b\u6709\u6548\u5b57\u7b26\u7684\u4e2a\u6570 *\/\n                    n = NumberOfChar();\n                    CreateHT(n);\n                    CreateHCode(n);\n                    OutputFile(n);\n                    system(\"pause\");\n                }\n                break;\n            case 2:\n                system(\"cls\");\n                if (ok)\n                {\n                    PrintHuffmanCode(n);\n                }\n                else\n                {\n                    printf(\"\u539f\u6587\u4ef6\u5c1a\u672a\u8bfb\u5165!\\n\");\n                }\n                system(\"pause\");\n                break;\n            case 3:\n                system(\"cls\");\n                if (ok)\n                {\n                    Encode(n);\n                }\n                else\n                {\n                    printf(\"\u539f\u6587\u4ef6\u5c1a\u672a\u8bfb\u5165!\\n\");\n                }\n                system(\"pause\");\n                break;\n            case 4:\n                system(\"cls\");\n                if (ok)\n                {\n                    Decode(n);\n                }\n                else\n                {\n                    printf(\"\u539f\u6587\u4ef6\u5c1a\u672a\u8bfb\u5165!\\n\");\n                }\n                system(\"pause\");\n                break;\n            case 5:\n                return 0;\n            default:\n                \/* \u9632\u6b62\u8f93\u5165\u9519\u8bef\u5e8f\u53f7\uff0c\u5237\u65b0\u7f13\u51b2\u533a *\/\n                fflush(stdin);\n        }\n    }\n    return 0;\n}\n\n\/* \u5feb\u901f\u6392\u5e8f\u6bd4\u8f83\u51fd\u6570 *\/\nint cmp(const void *a ,const void *b)\n{\n    return (*(Tree *)a).weight &lt; (*(Tree *)b).weight ? 1 : -1;\n}\n\n\/* \u7edf\u8ba1\u6709\u6548\u7684\u5b57\u7b26\u6570\u91cf *\/\nint NumberOfChar()\n{\n    int i, num = 0;\n    for (i = 0; i &lt; N; i++)\n    {\n        if (ht[i].weight &gt; 0) num++;\n    }\n    return num;\n}\n\n\/* \u521d\u59cb\u5316\u54c8\u592b\u66fc\u6811 *\/\nvoid Reset()\n{\n    int i;\n    for (i = 0; i &lt; M; i++)\n    {\n        ht[i].weight = 0;\n        ht[i].parent = -1;\n        ht[i].lchild = -1;\n        ht[i].rchild = -1;\n    }\n}\n\n\/* \u8bfb\u5165\u6587\u4ef6\u5185\u5bb9 *\/\nvoid InputFile()\n{\n    FILE *fp;\n    char ch;\n    system(\"cls\");\n    printf(\"\u8bf7\u8f93\u5165\u539f\u6587\u4ef6\u540d:\");\n    fflush(stdin);\n    scanf(\"%s\", file);\n    \n    \/* \u6253\u5f00\u539f\u6587\u4ef6 *\/\n    if ((fp = fopen(file, \"rt\")) == NULL)\n    {\n        printf(\"\u627e\u4e0d\u5230\u539f\u6587\u4ef6 %s!\\n\", file);\n        ok = 0;\n        system(\"pause\");\n        return;\n    }\n    \n    \/* \u8bfb\u5165\u5b57\u7b26\u5e76\u5904\u7406\u6743\u91cd *\/\n    while (fscanf(fp, \"%c\", &amp;ch) != EOF)\n    {\n        ht[ch].data = ch;\n        ht[ch].weight++;\n    }\n    \n    \/* \u5173\u95ed\u6587\u4ef6\u6307\u9488 *\/\n    fclose(fp);\n    printf(\"\u539f\u6587\u4ef6 %s \u8bfb\u5165\u6210\u529f!\\n\", file);\n    ok = 1;\n}\n\n\/* \u7f16\u7801 *\/\nvoid Encode(int n)\n{\n    int i, k;\n    char ch;\n    FILE *fp1, *fp2;\n    \n    \/* \u5229\u7528\u54c8\u592b\u66fc\u4ee3\u7801\u8868\u8fdb\u884c\u7f16\u7801 *\/\n    if (access(\"Huffman_Code.txt\",0) != 0)\n    {\n        printf(\"\u627e\u4e0d\u5230\u4ee3\u7801\u8868 Huffman_Code.txt !\\n\");\n        return;\n    }\n    \n    \/* \u6253\u5f00\u8981\u7f16\u7801\u7684\u539f\u6587\u4ef6 *\/\n    if ((fp1 = fopen(file, \"rt\")) == NULL)\n    {\n        printf(\"\u627e\u4e0d\u5230\u539f\u6587\u4ef6 %s !\\n\", file);\n        return;\n    }\n    \n    \/* \u751f\u6210\u7f16\u7801\u6587\u4ef6 *\/\n    if ((fp2 = fopen(\"Encode.txt\", \"wt+\")) == NULL)\n    {\n        printf(\"\u7f16\u7801\u6587\u4ef6 Encode.txt \u521b\u5efa\u5931\u8d25!\\n\");\n        return;\n    }\n    \n    \/* \u4e00\u4e2a\u5b57\u7b26\u4e00\u4e2a\u5b57\u7b26\u66ff\u6362 *\/\n    while (fscanf(fp1, \"%c\", &amp;ch) != EOF)\n    {\n        for (i = 0; i &lt; n; i++)\n        {\n            if (ht[i].data == ch)\n            {\n                for (k = hcd[i].start; k &lt;= n; k++)\n                {\n                    fprintf(fp2, \"%c\", hcd[i].cd[k]);\n                }\n            }\n        }\n    }\n    \n    \/* \u5173\u95ed\u6587\u4ef6\u6307\u9488 *\/\n    fclose(fp1);\n    fclose(fp2);\n    printf(\"\u7f16\u7801\u6210\u529f\uff0c\u7ed3\u679c\u5728 Encode.txt \u4e2d!\\n\");\n}\n\n\/* \u89e3\u7801 *\/\nvoid Decode(int n)\n{\n    int i, k;\n    char ch;\n    FILE *fp1, *fp2;\n    \n    \/* \u6253\u5f00\u8981\u89e3\u7801\u7684\u6587\u4ef6 *\/\n    if ((fp1 = fopen(\"Encode.txt\", \"rt\")) == NULL)\n    {\n        printf(\"\u627e\u4e0d\u5230\u7f16\u7801\u6587\u4ef6 Encode.txt!\\n\");\n        return;\n    }\n    \n    \/* \u751f\u6210\u89e3\u7801\u6587\u4ef6 *\/\n    if ((fp2 = fopen(\"Decode.txt\", \"wt+\")) == NULL)\n    {\n        printf(\"\u89e3\u7801\u6587\u4ef6 Decode.txt \u521b\u5efa\u5931\u8d25!\\n\");\n        return;\n    }\n    \n    \/* \u5229\u7528\u54c8\u592b\u66fc\u6811\u89e3\u7801 *\/\n    i = 2 * n - 2;\n    while (fscanf(fp1, \"%c\", &amp;ch) != EOF)\n    {\n        if (ch == '0')\n        {\n            i = ht[i].lchild;\n        }\n        else\n        {\n            i = ht[i].rchild;\n        }\n        \/* \u627e\u5230\u53f6\u5b50\u8282\u70b9\u4e3a\u6b62 *\/\n        if (ht[i].lchild == -1)\n        {\n            fprintf(fp2, \"%c\", ht[i].data);\n            \/* \u7ee7\u7eed\u4ece\u6839\u8282\u70b9\u5f00\u59cb\u67e5\u627e *\/\n            i = 2 * n - 2;\n        }\n    }\n    \n    \/* \u5173\u95ed\u6587\u4ef6\u6307\u9488 *\/\n    fclose(fp1);\n    fclose(fp2);\n    printf(\"\u89e3\u7801\u6210\u529f\uff0c\u7ed3\u679c\u5728 Decode.txt \u4e2d!\\n\");\n}\n\n\/* \u8f93\u51fa\u54c8\u5f17\u66fc\u7f16\u7801\u5230\u6587\u4ef6 *\/\nvoid OutputFile(int n)\n{\n    FILE *fp;\n    int i, k;\n    \n    \/* \u751f\u6210\u54c8\u592b\u66fc\u4ee3\u7801\u8868\u6587\u4ef6 *\/\n    if ((fp = fopen(\"Huffman_Code.txt\", \"wt+\")) == NULL)\n    {\n        printf(\"\u4ee3\u7801\u8868\u6587\u4ef6 Huffman_Code.txt \u521b\u5efa\u5931\u8d25!\\n\");\n        return;\n    }\n    \n    \/* \u5c06\u5185\u5b58\u91cc\u7684\u4e1c\u897f\u5199\u5165\u6587\u4ef6 *\/\n    for (i = 0; i &lt; n; i++)\n    {\n        fprintf(fp, \"%d \", ht[i].data);\n        for (k = hcd[i].start; k &lt;= n; k++)\n        {\n            fprintf(fp, \"%c\", hcd[i].cd[k]);\n        }\n        if (i &lt; n - 1) fprintf(fp, \"\\n\");\n    }\n    \n    \/* \u5173\u95ed\u6587\u4ef6\u6307\u9488 *\/\n    fclose(fp);\n    printf(\"\u4ee3\u7801\u8868\u6587\u4ef6 Huffman_Code.txt \u751f\u6210\u6210\u529f!\\n\");\n}\n\n\/* \u6253\u5370\u54c8\u592b\u66fc\u7f16\u7801\u5230\u5c4f\u5e55 *\/\nvoid PrintHuffmanCode(int n)\n{\n    int i, k;\n    printf(\"ASCII \\t Char \\t HuffmanCode\\n\");\n    for (i = 0; i &lt; n; i++)\n    {\n        printf(\"%d \\t \\\"%c\\\" \\t \", ht[i].data, ht[i].data);\n        for (k = hcd[i].start; k &lt;= n; k++)\n        {\n            printf(\"%c\", hcd[i].cd[k]);\n        }\n        printf(\"\\n\");\n    }\n}\n\n\/* \u6784\u9020\u54c8\u592b\u66fc\u6811 *\/\nvoid CreateHT(int n)\n{\n    int i, k ,lmin, rmin;\n    int min1, min2;\n    \n    \/* \u4e00\u5171\u67092n-1\u4e2a\u8282\u70b9 *\/\n    for (i = n; i &lt; 2 * n - 1; i++)\n    {\n        \/*lmin\u548crmin\u4e3a\u6700\u5c0f\u6743\u91cd\u7684\u4e24\u4e2a\u8282\u70b9\u7f6e*\/\n        min1 = min2 = 0x7FFFFFFF;\n        lmin = rmin = -1;\n        for (k = 0; k &lt;= i - 1; k++)\n        {\n            \/*\u53ea\u5728\u5c1a\u672a\u6784\u9020\u4e8c\u53c9\u6811\u7684\u8282\u70b9\u4e2d\u67e5\u627e*\/\n            if (ht[k].parent == -1)\n            {\n                if (ht[k].weight &lt; min1)\n                {\n                    min2 = min1;\n                    rmin = lmin;\n                    min1 = ht[k].weight;\n                    lmin = k;\n                }\n                else if (ht[k].weight &lt; min2)\n                {\n                    min2 = ht[k].weight;\n                    rmin = k;\n                }\n            }\n        }\n        \n        \/* \u4fee\u65392\u4e2a\u5c0f\u6743\u91cd\u8282\u70b9\u7684\u53cc\u4eb2 *\/\n        ht[lmin].parent = i;\n        ht[rmin].parent = i;\n        \n        \/* \u4fee\u6539\u53cc\u4eb2\u7684\u6743\u91cd *\/\n        ht[i].weight = ht[lmin].weight + ht[rmin].weight;\n        \n        \/* \u4fee\u6539\u53cc\u4eb2\u7684\u5b69\u5b50 *\/\n        ht[i].lchild = lmin;\n        ht[i].rchild = rmin;\n    }\n}\n\n\/* \u5f97\u5230\u54c8\u592b\u66fc\u7f16\u7801 *\/\nvoid CreateHCode(int n)\n{\n    int i, f, c;\n    Code hc;\n    \n    \/* \u6839\u636e\u54c8\u592b\u66fc\u6811\u6c42\u54c8\u592b\u66fc\u7f16\u7801 *\/\n    for (i = 0; i &lt; n; i++)\n    {\n        hc.start = n;\n        c = i;\n        f = ht[i].parent;\n        \n        \/* \u5faa\u5e8f\u76f4\u5230\u6811\u6839\u7ed3\u70b9 *\/\n        while (f != -1)\n        {\n            \/* \u5904\u7406\u5de6\u5b69\u5b50\u7ed3\u70b9 *\/\n            if (ht[f].lchild == c)\n            {\n                hc.cd[hc.start--] = '0';\n            }\n            \/* \u5904\u7406\u53f3\u5b69\u5b50\u7ed3\u70b9 *\/\n            else\n            {\n                hc.cd[hc.start--] = '1';\n            }\n            c = f;\n            f = ht[f].parent;\n        }\n        \n        \/* start\u6307\u5411\u54c8\u592b\u66fc\u7f16\u7801\u6700\u5f00\u59cb\u5b57\u7b26 *\/\n        hc.start++;\n        hcd[i] = hc;\n    }\n}<\/pre><\/div>\n<p>\u8f6c\u8f7d\u8bf7\u6ce8\u660e\uff1a<a href=\"http:\/\/www.slyar.com\/blog\">Slyar Home<\/a> &raquo; <a href=\"http:\/\/www.slyar.com\/blog\/huffman-tree-code-c.html\">C\u7a0b\u5e8f\u5b9e\u8df5 \u54c8\u592b\u66fc(Huffman)\u6811\u4ee3\u7801<\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u4f5c\u8005\uff1a\u59dc\u5357(Slyar) \u6587\u7ae0\u6765\u6e90\uff1aSlyar Home (www.slyar.com) \u8f6c\u8f7d\u8bf7\u6ce8\u660e\uff0c\u8c22\u8c22\u5408\u4f5c\u3002 \u5b9e\u9a8c\u8bfe\u5185\u5bb9\u7684\u4ee3\u7801\uff0c\u65e0\u804a\u53d1\u51fa\u6765\u3002 \u529f\u80fd\u5305\u62ec\u4ece\u6587\u4ef6\u4e2d\u8bfb\u53d6\u6587\u7ae0\uff0c\u5c06\u6587\u7ae0\u8f6c\u6362\u4e3a\u54c8\u592b\u66fc\u7f16\u7801\uff0c\u5c06\u54c8\u592b\u66fc\u7f16\u7801\u8fd8\u539f\uff0c\u5c31\u662f\u90a3\u51e0\u4e2a\u57fa\u672c\u7b97\u6cd5\u7684\u5b9e\u73b0\u5566\u3002 \u4e3a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[303,258],"class_list":["post-1117","post","type-post","status-publish","format-standard","hentry","category-programing","tag-303","tag-258"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.2.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"C\u7a0b\u5e8f\u5b9e\u8df5 \u54c8\u592b\u66fc(Huffman)\u6811\u6e90\u4ee3\u7801\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Slyar\"\/>\n\t<meta name=\"keywords\" content=\"slyar,c,huffman,\u54c8\u592b\u66fc,\u4e8c\u53c9\u6811,\u6e90\u4ee3\u7801,\u5b9e\u8df5\" \/>\n\t<link rel=\"canonical\" href=\"http:\/\/www.slyar.com\/blog\/huffman-tree-code-c.html\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.2.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"zh_CN\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Slyar Home | \u8bb0\u5f55\u4e2a\u4eba\u751f\u6d3b\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"C\u7a0b\u5e8f\u5b9e\u8df5 \u54c8\u592b\u66fc(Huffman)\u6811\u4ee3\u7801 - Slyar Home\" \/>\n\t\t<meta property=\"og:description\" content=\"C\u7a0b\u5e8f\u5b9e\u8df5 \u54c8\u592b\u66fc(Huffman)\u6811\u6e90\u4ee3\u7801\" \/>\n\t\t<meta property=\"og:url\" content=\"http:\/\/www.slyar.com\/blog\/huffman-tree-code-c.html\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2009-12-04T04:20:21+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2022-06-23T06:27:01+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"C\u7a0b\u5e8f\u5b9e\u8df5 \u54c8\u592b\u66fc(Huffman)\u6811\u4ee3\u7801 - Slyar Home\" \/>\n\t\t<meta name=\"twitter:description\" content=\"C\u7a0b\u5e8f\u5b9e\u8df5 \u54c8\u592b\u66fc(Huffman)\u6811\u6e90\u4ee3\u7801\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/huffman-tree-code-c.html#article\",\"name\":\"C\\u7a0b\\u5e8f\\u5b9e\\u8df5 \\u54c8\\u592b\\u66fc(Huffman)\\u6811\\u4ee3\\u7801 - Slyar Home\",\"headline\":\"C\\u7a0b\\u5e8f\\u5b9e\\u8df5 \\u54c8\\u592b\\u66fc(Huffman)\\u6811\\u4ee3\\u7801\",\"author\":{\"@id\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/author\\\/slyar#author\"},\"publisher\":{\"@id\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/#person\"},\"image\":{\"@type\":\"ImageObject\",\"@id\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/huffman-tree-code-c.html#articleImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/fa995532c4fa6a1a16430db283689338da430a677b2ff974e0cad68e3bba05c4?s=96&d=monsterid\",\"width\":96,\"height\":96,\"caption\":\"Slyar\"},\"datePublished\":\"2009-12-04T12:20:21-08:00\",\"dateModified\":\"2022-06-22T23:27:01-07:00\",\"inLanguage\":\"zh-CN\",\"commentCount\":5,\"mainEntityOfPage\":{\"@id\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/huffman-tree-code-c.html#webpage\"},\"isPartOf\":{\"@id\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/huffman-tree-code-c.html#webpage\"},\"articleSection\":\"\\u7f16\\u7a0b\\u76f8\\u5173, \\u7814\\u7a76, \\u7b97\\u6cd5\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/huffman-tree-code-c.html#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/category\\\/programing#listItem\",\"name\":\"\\u7f16\\u7a0b\\u76f8\\u5173\"}},{\"@type\":\"ListItem\",\"@id\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/category\\\/programing#listItem\",\"position\":2,\"name\":\"\\u7f16\\u7a0b\\u76f8\\u5173\",\"item\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/category\\\/programing\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/huffman-tree-code-c.html#listItem\",\"name\":\"C\\u7a0b\\u5e8f\\u5b9e\\u8df5 \\u54c8\\u592b\\u66fc(Huffman)\\u6811\\u4ee3\\u7801\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/huffman-tree-code-c.html#listItem\",\"position\":3,\"name\":\"C\\u7a0b\\u5e8f\\u5b9e\\u8df5 \\u54c8\\u592b\\u66fc(Huffman)\\u6811\\u4ee3\\u7801\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/category\\\/programing#listItem\",\"name\":\"\\u7f16\\u7a0b\\u76f8\\u5173\"}}]},{\"@type\":\"Person\",\"@id\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/#person\",\"name\":\"Slyar\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/huffman-tree-code-c.html#personImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/fa995532c4fa6a1a16430db283689338da430a677b2ff974e0cad68e3bba05c4?s=96&d=monsterid\",\"width\":96,\"height\":96,\"caption\":\"Slyar\"}},{\"@type\":\"Person\",\"@id\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/author\\\/slyar#author\",\"url\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/author\\\/slyar\",\"name\":\"Slyar\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/huffman-tree-code-c.html#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/fa995532c4fa6a1a16430db283689338da430a677b2ff974e0cad68e3bba05c4?s=96&d=monsterid\",\"width\":96,\"height\":96,\"caption\":\"Slyar\"}},{\"@type\":\"WebPage\",\"@id\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/huffman-tree-code-c.html#webpage\",\"url\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/huffman-tree-code-c.html\",\"name\":\"C\\u7a0b\\u5e8f\\u5b9e\\u8df5 \\u54c8\\u592b\\u66fc(Huffman)\\u6811\\u4ee3\\u7801 - Slyar Home\",\"description\":\"C\\u7a0b\\u5e8f\\u5b9e\\u8df5 \\u54c8\\u592b\\u66fc(Huffman)\\u6811\\u6e90\\u4ee3\\u7801\",\"inLanguage\":\"zh-CN\",\"isPartOf\":{\"@id\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/huffman-tree-code-c.html#breadcrumblist\"},\"author\":{\"@id\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/author\\\/slyar#author\"},\"creator\":{\"@id\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/author\\\/slyar#author\"},\"datePublished\":\"2009-12-04T12:20:21-08:00\",\"dateModified\":\"2022-06-22T23:27:01-07:00\"},{\"@type\":\"WebSite\",\"@id\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/#website\",\"url\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/\",\"name\":\"Slyar Home\",\"description\":\"\\u8bb0\\u5f55\\u4e2a\\u4eba\\u751f\\u6d3b\",\"inLanguage\":\"zh-CN\",\"publisher\":{\"@id\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/#person\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"C\u7a0b\u5e8f\u5b9e\u8df5 \u54c8\u592b\u66fc(Huffman)\u6811\u4ee3\u7801 - Slyar Home","description":"C\u7a0b\u5e8f\u5b9e\u8df5 \u54c8\u592b\u66fc(Huffman)\u6811\u6e90\u4ee3\u7801","canonical_url":"http:\/\/www.slyar.com\/blog\/huffman-tree-code-c.html","robots":"max-image-preview:large","keywords":"slyar,c,huffman,\u54c8\u592b\u66fc,\u4e8c\u53c9\u6811,\u6e90\u4ee3\u7801,\u5b9e\u8df5","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"http:\/\/www.slyar.com\/blog\/huffman-tree-code-c.html#article","name":"C\u7a0b\u5e8f\u5b9e\u8df5 \u54c8\u592b\u66fc(Huffman)\u6811\u4ee3\u7801 - Slyar Home","headline":"C\u7a0b\u5e8f\u5b9e\u8df5 \u54c8\u592b\u66fc(Huffman)\u6811\u4ee3\u7801","author":{"@id":"http:\/\/www.slyar.com\/blog\/author\/slyar#author"},"publisher":{"@id":"http:\/\/www.slyar.com\/blog\/#person"},"image":{"@type":"ImageObject","@id":"http:\/\/www.slyar.com\/blog\/huffman-tree-code-c.html#articleImage","url":"https:\/\/secure.gravatar.com\/avatar\/fa995532c4fa6a1a16430db283689338da430a677b2ff974e0cad68e3bba05c4?s=96&d=monsterid","width":96,"height":96,"caption":"Slyar"},"datePublished":"2009-12-04T12:20:21-08:00","dateModified":"2022-06-22T23:27:01-07:00","inLanguage":"zh-CN","commentCount":5,"mainEntityOfPage":{"@id":"http:\/\/www.slyar.com\/blog\/huffman-tree-code-c.html#webpage"},"isPartOf":{"@id":"http:\/\/www.slyar.com\/blog\/huffman-tree-code-c.html#webpage"},"articleSection":"\u7f16\u7a0b\u76f8\u5173, \u7814\u7a76, \u7b97\u6cd5"},{"@type":"BreadcrumbList","@id":"http:\/\/www.slyar.com\/blog\/huffman-tree-code-c.html#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"http:\/\/www.slyar.com\/blog\/#listItem","position":1,"name":"Home","item":"http:\/\/www.slyar.com\/blog\/","nextItem":{"@type":"ListItem","@id":"http:\/\/www.slyar.com\/blog\/category\/programing#listItem","name":"\u7f16\u7a0b\u76f8\u5173"}},{"@type":"ListItem","@id":"http:\/\/www.slyar.com\/blog\/category\/programing#listItem","position":2,"name":"\u7f16\u7a0b\u76f8\u5173","item":"http:\/\/www.slyar.com\/blog\/category\/programing","nextItem":{"@type":"ListItem","@id":"http:\/\/www.slyar.com\/blog\/huffman-tree-code-c.html#listItem","name":"C\u7a0b\u5e8f\u5b9e\u8df5 \u54c8\u592b\u66fc(Huffman)\u6811\u4ee3\u7801"},"previousItem":{"@type":"ListItem","@id":"http:\/\/www.slyar.com\/blog\/#listItem","name":"Home"}},{"@type":"ListItem","@id":"http:\/\/www.slyar.com\/blog\/huffman-tree-code-c.html#listItem","position":3,"name":"C\u7a0b\u5e8f\u5b9e\u8df5 \u54c8\u592b\u66fc(Huffman)\u6811\u4ee3\u7801","previousItem":{"@type":"ListItem","@id":"http:\/\/www.slyar.com\/blog\/category\/programing#listItem","name":"\u7f16\u7a0b\u76f8\u5173"}}]},{"@type":"Person","@id":"http:\/\/www.slyar.com\/blog\/#person","name":"Slyar","image":{"@type":"ImageObject","@id":"http:\/\/www.slyar.com\/blog\/huffman-tree-code-c.html#personImage","url":"https:\/\/secure.gravatar.com\/avatar\/fa995532c4fa6a1a16430db283689338da430a677b2ff974e0cad68e3bba05c4?s=96&d=monsterid","width":96,"height":96,"caption":"Slyar"}},{"@type":"Person","@id":"http:\/\/www.slyar.com\/blog\/author\/slyar#author","url":"http:\/\/www.slyar.com\/blog\/author\/slyar","name":"Slyar","image":{"@type":"ImageObject","@id":"http:\/\/www.slyar.com\/blog\/huffman-tree-code-c.html#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/fa995532c4fa6a1a16430db283689338da430a677b2ff974e0cad68e3bba05c4?s=96&d=monsterid","width":96,"height":96,"caption":"Slyar"}},{"@type":"WebPage","@id":"http:\/\/www.slyar.com\/blog\/huffman-tree-code-c.html#webpage","url":"http:\/\/www.slyar.com\/blog\/huffman-tree-code-c.html","name":"C\u7a0b\u5e8f\u5b9e\u8df5 \u54c8\u592b\u66fc(Huffman)\u6811\u4ee3\u7801 - Slyar Home","description":"C\u7a0b\u5e8f\u5b9e\u8df5 \u54c8\u592b\u66fc(Huffman)\u6811\u6e90\u4ee3\u7801","inLanguage":"zh-CN","isPartOf":{"@id":"http:\/\/www.slyar.com\/blog\/#website"},"breadcrumb":{"@id":"http:\/\/www.slyar.com\/blog\/huffman-tree-code-c.html#breadcrumblist"},"author":{"@id":"http:\/\/www.slyar.com\/blog\/author\/slyar#author"},"creator":{"@id":"http:\/\/www.slyar.com\/blog\/author\/slyar#author"},"datePublished":"2009-12-04T12:20:21-08:00","dateModified":"2022-06-22T23:27:01-07:00"},{"@type":"WebSite","@id":"http:\/\/www.slyar.com\/blog\/#website","url":"http:\/\/www.slyar.com\/blog\/","name":"Slyar Home","description":"\u8bb0\u5f55\u4e2a\u4eba\u751f\u6d3b","inLanguage":"zh-CN","publisher":{"@id":"http:\/\/www.slyar.com\/blog\/#person"}}]},"og:locale":"zh_CN","og:site_name":"Slyar Home | \u8bb0\u5f55\u4e2a\u4eba\u751f\u6d3b","og:type":"article","og:title":"C\u7a0b\u5e8f\u5b9e\u8df5 \u54c8\u592b\u66fc(Huffman)\u6811\u4ee3\u7801 - Slyar Home","og:description":"C\u7a0b\u5e8f\u5b9e\u8df5 \u54c8\u592b\u66fc(Huffman)\u6811\u6e90\u4ee3\u7801","og:url":"http:\/\/www.slyar.com\/blog\/huffman-tree-code-c.html","article:published_time":"2009-12-04T04:20:21+00:00","article:modified_time":"2022-06-23T06:27:01+00:00","twitter:card":"summary","twitter:title":"C\u7a0b\u5e8f\u5b9e\u8df5 \u54c8\u592b\u66fc(Huffman)\u6811\u4ee3\u7801 - Slyar Home","twitter:description":"C\u7a0b\u5e8f\u5b9e\u8df5 \u54c8\u592b\u66fc(Huffman)\u6811\u6e90\u4ee3\u7801"},"aioseo_meta_data":{"post_id":"1117","title":"C\u7a0b\u5e8f\u5b9e\u8df5 \u54c8\u592b\u66fc(Huffman)\u6811\u4ee3\u7801 - #site_title","description":"C\u7a0b\u5e8f\u5b9e\u8df5 \u54c8\u592b\u66fc(Huffman)\u6811\u6e90\u4ee3\u7801","keywords":[{"label":"slyar","value":"slyar"},{"label":"C","value":"C"},{"label":"huffman","value":"huffman"},{"label":"\u54c8\u592b\u66fc","value":"\u54c8\u592b\u66fc"},{"label":"\u4e8c\u53c9\u6811","value":"\u4e8c\u53c9\u6811"},{"label":"\u6e90\u4ee3\u7801","value":"\u6e90\u4ee3\u7801"},{"label":"\u5b9e\u8df5","value":"\u5b9e\u8df5"}],"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":[],"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":{"id":"aioseo-article-634ea357e6a8e","slug":"article","graphName":"Article","label":"\u6587\u7ae0","properties":{"type":"BlogPosting","name":"#post_title","headline":"#post_title","description":"#post_excerpt","image":"","keywords":"","author":{"name":"#author_name","url":"#author_url"},"dates":{"include":true,"datePublished":"","dateModified":""}}},"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":"{\"article\":{\"articleType\":\"BlogPosting\"},\"course\":{\"name\":\"\",\"description\":\"\",\"provider\":\"\"},\"faq\":{\"pages\":[]},\"product\":{\"reviews\":[]},\"recipe\":{\"ingredients\":[],\"instructions\":[],\"keywords\":[]},\"software\":{\"reviews\":[],\"operatingSystems\":[]},\"webPage\":{\"webPageType\":\"WebPage\"}}","pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2021-02-10 02:44:15","updated":"2022-10-18 13:00:07","seo_analyzer_scan_date":null,"focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"_links":{"self":[{"href":"http:\/\/www.slyar.com\/blog\/wp-json\/wp\/v2\/posts\/1117","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.slyar.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.slyar.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.slyar.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.slyar.com\/blog\/wp-json\/wp\/v2\/comments?post=1117"}],"version-history":[{"count":3,"href":"http:\/\/www.slyar.com\/blog\/wp-json\/wp\/v2\/posts\/1117\/revisions"}],"predecessor-version":[{"id":7866,"href":"http:\/\/www.slyar.com\/blog\/wp-json\/wp\/v2\/posts\/1117\/revisions\/7866"}],"wp:attachment":[{"href":"http:\/\/www.slyar.com\/blog\/wp-json\/wp\/v2\/media?parent=1117"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.slyar.com\/blog\/wp-json\/wp\/v2\/categories?post=1117"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.slyar.com\/blog\/wp-json\/wp\/v2\/tags?post=1117"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}