知识卡片
编码树深度决定位数
前缀码可用二叉树表示:字符在叶子,左边为0、右边为1,根到叶路径形成码字。
字符频率乘叶深再求和就是编码文件的总位数;优化编码可转为最小化频率加权叶深。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 第15章 贪心算法 · 查看原书依据
Interpret the binary codeword for a character as the simple path from the root to that character, where 0 means “go to the left child” and 1 means “go to the right child.”
参考来源
- 位置:《算法导论(第4版)》第15章《贪心算法》(OEBPS/chapter015.xhtml,文本字符[35000,40000))。
- 结论依据:15.3 节以编码树叶子存字符、左边记0右边记1;码字长度就是根到叶深度,文件位数 B(T)=Σf(c)d_T(c)。
- 原始内容:Interpret the binary codeword for a character as the simple path from the root to that character, where 0 means “go to the left child” and 1 means “go to the right child.”