Escolar Documentos
Profissional Documentos
Cultura Documentos
Is the code in which each codeword in any string of codewrds can be decoded
( reading from left to right) as soon as it is received
It will be expressed by code trees (so in the following we study something
about graphs and trees)
Graph : a graph G = (V, E ) where
V = { v1 ,, vs } is a set of vertices (nodes)
E = { e 1 ,.,en } is a set of edges
e i : vk
vj
ei : vk
vj
Tree : a tree is a special digraph with a start distinct node called root
A path : is a sequence of arcs (edges)
Kraft Inequality
It examines : What requirements must be met by a code in order for it to be
instantaneously decodable
n
r li = l
i=1
2 li = l
i=1
Note : (1). K.I. means : if the lengths l1 , .., ln satisfy K.I., then there must exist some
instantaneous code with these lengths.
(2). K.I. does not mean : any code whose codeword lengths satisfy K.I. must
be instantaneous .
Example:
Symbol
A
B
Code
0
01
length
1
2
2 li = 2 l1 + 2 l2 = 2 l + 2 2 = = 1
i=1
(2 )
it satisfy K.I. , But it is not instantaneous
(because it can not be represented as a binary tree )
(1)
But by note (1) there must exist some instantaneous code with these
lengths (i.e 1 and 2 ), which can be
Symbol
A
B
Code
0
11
length
1
2
2 li = = 1
i=1
and
1
11
0
0
Uniquely Decodable
If any encoded string has only one possible source string producing it then
we have unique decodablity
extension
Sn =
a1 , ., am
p1, , pm
a1 a1 a1 , a1 a1 .. a1 a2 , ..,
p1 p1 p1, p1 p1 p1 p2, ,
am am . am
pm pm pm
a1 a1 , a1 a2 , a1 a3 ....,am am
p1 p1, p1 p2, p1 p3 ,pm pm
Code
1
10
100
1000
AA AB AC
AD BA BB BC
BD CA CB
CC CD
DA
DB
DC
DD
11 110 1100 11000 101 1010 10100 101000 1001 10010 100100 101000 10001 100010 1000100 10001000
Non-singular codes
McMillan inequality
McMillan inequality extends Kraft's inequality to uniquely decodable codes
i.e. The codeword lengths of any uniquely decodable code must satisfy the Kraft's
inequality
i=1 r li = l
r = 2
n
i=1 2 li = l
a1 , a2 am
p1, p2 pm
L=
Pi li = P1 l1 + P2 l2 + .. + Pm lm
i =1
m
= -
Pi log2 q i
i =1
where q i = 2- li = ()li , i = 1 , 2 , , m
L = - Pi log2 Pi
i =1
Huffman Code
v With the Huffman code in the binary case the two least probable
source output symbols are joined together, resulting in a new
message alphabet with one less symbol
v Huffman Code is also Compact code and satisfies the properties:
1. Has the shortest mean length among binary instantaneous
codes
2. Optimal tree
3. Compact Code tree