返回主题:文本压缩与熵编码

知识卡片

普通读书笔记卡 · 3626.b

变长编码给高频字符短码

理解等级:中级

字符编码给每个字符唯一二进制码字。

  • 定长编码对 n 个字符需每个码字至少 ⌈lg n⌉ 位;
  • 变长编码可给高频字符更短码字,从而减少按出现次数加权的总位数,但仍需保证可解析性。
这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • 第15章 贪心算法 · 查看原书依据

      A variable-length code can do considerably better than a fixed-length code. The idea is simple: give frequent characters short codewords and infrequent characters long codewords.

    参考来源

    - 位置:《算法导论(第4版)》第 15 章《贪心算法》(OEBPS/chapter015.xhtml,文本字符 [30000, 35000))。 - 结论依据:原文对照固定长度与按频率分配长度的编码,并给出六字符示例。 - 原始内容:A variable-length code can do considerably better than a fixed-length code. The idea is simple: give frequent characters short codewords and infrequent characters long codewords.