首页 > 其他分享 >5.2 Kraft Inequality

5.2 Kraft Inequality

时间:2023-10-15 09:03:43浏览次数:42  
标签:... 5.2 code tree prefix Inequality codeword Kraft

首先引入一些基础的定义:

  • \(C: S_X \rightarrow \mathcal{D}^*\): the source code for a r.v. \(X\), where \(S_X\) is the range of \(X\), \(\mathcal{D}^*\) is the set of finite-length strings of symbols from a \(D\)-ary alphabet.

  • WLOG, assume that \(D\)-ary alphabet = \(\mathcal{D}=\{0,1,...,D-1\}\).

  • \(C(x)\): the codeword corresponding to \(x\)

  • \(l(x)\): the length of \(C(x)\)

  • \(L(C)=\sum_{x\in S_X} p(x)l(x)\): the expected length of a source code \(C\) for \(X\), \(p(x)\) is the pmf of \(X\).

进一步引入一些 codes 的类别定义:

  • A code \(C\) is said to be nonsingular if \(x\neq x' \Rightarrow C(x)\neq C(x')\).

  • the extension \(C^*\) of a code \(C\) is \(C(x_1 x_2 ... x_n)=c(x_1)C(x_2)...C(x_n)\).

  • A code is called uniquely decodable if its extension is nonsingular.

  • A code is called a prefix/ instantaneous code if no codeword is a prefix of any other codeword.

我们的目标:

We wish to design prefix codes with minimum \(L(C)\). If we assign the short codewords to all source symbols, \(C\) may not be prefix-free. So Kraft inequality gives the limitation of codeword lengths for prefix codes.

Thm. 5.2.1 (Kraft Inequality) For any prefix code over an alphabet of size \(D\), the codeword lengths \(l_1,l_2,...,l_m\) must satisfy the inequality

\[\sum_{i=1}^{m} D^{-l_i} \leq 1 \]

Conversely, given a set of codeword lengths that satisfy (1), there exists a prefix code with these word lengths.

证明:

  • Consider a D-ary tree, which means each node in this tree has D children.

  • Assign \(\{0,1,..., D-1\}\) to the branches arising from one node(including the root).

  • Then, each codeword is represented by a leaf on the tree, the specific symbols of each codeword are the path from root to this leaf.

  • The above figure is an example of D=2.

  • Let \(l_m\) be the length of the longest codeword, then if the code tree is complete, on \(l_m\)-th layer, there are \(D^{l_m}\) nodes/ leaves.

  • If there is a leaf at level \(l_i\) (\(l_i \leq l_m\)), which means its \(D^{l_m-l_i}\) desendants at level \(l_m\) don't exist in the tree, because \(C\) is prefix-free.

  • Then, it is very obvious that the number of these descendants are less than or equal to \(D^{l_m}\):

\[\sum_{i=1}^{m} D^{l_{m}-l_i} \leq D^{l_{m}} \Rightarrow \sum_{i=1}^{m} D^{-l_i} \leq 1 \]

标签:...,5.2,code,tree,prefix,Inequality,codeword,Kraft
From: https://www.cnblogs.com/setdong/p/17765205.html

相关文章

  • AWVS15.2 Crack Windows&& Linux
    Windows安装过程https://www.ddosi.org/awvs-15-2/Linux&&Kali安装过程https://fahai.org/jszt/18.htmlQ:好像本机访问不了,但是能ping通......
  • 切比雪夫单调不等式(Chebyshev's monotonic inequality)(一般分配律)
    前置知识:一般分配律:\(\displaystyle\sum_{\substack{j\inJ\\k\inK}}a_jb_k\)\(=\displaystyle\sum_{\substack{j\inJ}}\displaystyle\sum_{\substack{k\inK}}a_jb_k\)\(=(\displaystyle\sum_{\substack{j\inJ}}a_j)(\displaystyle\sum_{\substac......
  • elk5.2升级到7.17的问题
    elk5.2升级到7.17记个流水账,从能用到原nginx日志格式能写入到logstash折腾了好几天。官方有个升级路线的(大家要克服下读英文的恐惧),对于我这个5.2的版本(单机版,网上很多都是集群版),升级路线是这样的:5.2.x——》5.6——》6.8——》7.17.125.2.x——》5.6,直......
  • Packet Tracer V5.2-5.3官方正式版下载
    《思科路由器交换机模拟软件》(Ciscopackettracer)官方5.2-5.3版+[压缩包]下载地址:http://www.verycd.com/topics/2823603/1、模拟器实际设备的硬件!这个对于网络技术学习者而言可是跟玩真机一样,设备模块、面板显示跟真机一样!安装模块还需要Poweroff!我想这个功能对于那些还没有见......
  • nginx-clojure nginx 1.25.2 版本docker 镜像
    主要是测试下nginx-clojure有nginx1.25.2的兼容性,顺便基于原有的构建弄一个方便测试的debug版本的镜像构建构建命令实际结合业务修改下./configure--prefix=--sbin-path=nginx--conf-path=conf/nginx.conf--error-log-path=logs/error.log--http-log-path......
  • 5.2 磁盘CRC32完整性检测
    CRC校验技术是用于检测数据传输或存储过程中是否出现了错误的一种方法,校验算法可以通过计算应用与数据的循环冗余校验(CRC)检验值来检测任何数据损坏。通过运用本校验技术我们可以实现对特定内存区域以及磁盘文件进行完整性检测,并以此来判定特定程序内存是否发生了变化,如果发生变化......
  • Qt 6.5.2安装教程
    1先去下载在线安装包,例如,因为有时候这个软件会更新,老的会安装不了。  一、先去官方网站下载安装包https://download.qt.io/official_releases/online_installers/二、安装之前请指向国内的镜像,这样下载速度很快例如我下载的qt-unified-windows-x64-x.x.x-online.exe存放在d......
  • UOS服务器操作系统安装Zabbix-5.2.1
    需求描述:在UOS服务器系统中安装Zabbix,并添加监控主机。软件信息:   UOS系统版本:1030amdserver  Zabbix版本:5.2.1环境信息:   zabbix-server   192.168.26.110  zabbix-client    192.168.26.111安装Zabbix-server   #wgethttps://repo.zabbix.com/z......
  • QT6.5.2msvc2022静态编译套件成品32位
    我自己编译的QT6.5.2成品库,静态编译,release和debug版本,压缩包250m解压后1G要是自己编译需要占用70G磁盘空间而且非常慢。关键词:QT6.5.2;QT静态编译;QT开发套件成品链接:https://pan.baidu.com/s/1vGBzn-hJwO1vsYp3dfpteA提取码:gaey......
  • [SpringSecurity5.2.2源码分析七]:WebAsyncManagerIntegrationFilter
    1、作用• 是为了接口返回异步对象,然后执行异步任务也能通过SecurityContextHolder获取SecurityContext• 比如说返回值是WebAsyncTask的时候2、WebAsyncManagerIntegrationFilter• 源码很短就是在WebAsyncManager中注册了SecurityContextCallableProcessingInterceptorpublic......