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

知识卡片

普通读书笔记卡 · 3626.a.2.b.1

霍夫曼合并保持最优子结构

理解等级:高级

将最低频的两个字符合并成一个频率为二者之和的伪字符,求合并后字母表的最优编码树,再把伪字符展开为两个孩子,可得到原问题的最优树。

展开前后成本只差二者频率之和,反证可说明次级树若不最优就会改进原树。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

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

      Then the tree T, obtained from T′ by replacing the leaf node for z with an internal node having x and y as children, represents an optimal prefix-free code for the alphabet C.

    参考来源

    - 位置:《算法导论(第4版)》第15章《贪心算法》(OEBPS/chapter015.xhtml,文本字符[45000,50000))。 - 结论依据:引理15.3 合并最低频 x、y 为频率和 z;展开合并树时成本增加 f(x)+f(y),若缩约树还能改进则原树也能改进,构成最优子结构。 - 原始内容:Then the tree T , obtained from T ′ by replacing the leaf node for z with an internal node having x and y as children, represents an optimal prefix-free code for the alphabet C .