Professional Documents
Culture Documents
Cdmtcs Research Series: Ludwig Staiger
Cdmtcs Research Series: Ludwig Staiger
Research
Report
Series
Ludwig Staiger
Martin-Luther-Universität
Halle-Wittenberg
CDMTCS-280
May 2006
Algorithm MaxKraft
0 n := 0 ; l := 0 ; C := ∅ ; M := ∅
1 For i = 1 to ∞ do
2 l := f (n) ; W := X l \ C · X ∗ ; M := M ∪ {l}
3 Let W = {w1 , . . . , w|W| }
4 For j = 0 to |W| − 1 do
5 C := C ∪ {w j+1 · 0 f (n+ j)−l }
6 Endfor
7 n := n + |W|
8 Endfor
Here the set M is included just to have a reference to Lemma 3.
At stage i + 1 our parameters before constructing the new approximation Ci+1
are Ci , ni and li+1 = f (ni ) where f (ni − 1) = sup{|w| : w ∈ Ci }.
Then the set Wi+1 = X li+1 \ Ci · X ∗ is the set of words which have no prefix in
Ci . For each of the words {w1 , . . . , w|Wi+1 | }, the body of the For-loop (lines 4 to 6)
adds the word w j+1 · 0 f (ni+1 + j)−li+1 of length f (ni+1 + j) to Ci . Thus f ( j) is the length
of the jth word in Ci+1 if j ≤ |Ci+1 |, in particular f (ni+1 − 1) = sup{|w| : w ∈ Ci+1 }.
As in the proof of Kraft’s inequality, we obtain that
X |Ci |
X
|Wi+1 | = |X|li+1 −|v|
= |X|li+1
· |X|− f ( j) < |X|li+1 .
v∈Ci j=1
Consequently, the algorithm does not stop, that is, Ci ⊂ Ci+1 , and returns an
infinite set C = ∞
S
i=1 C i in which the word constructed in step j has length f ( j).
Clearly, the resulting Ci+1 is a prefix-code, if Ci is a prefix-code, and by the
steps in lines 4 and 5 every word of length li+1 has a prefix in Ci ⊆ Ci+1 or is a
prefix of some word in Ci+1 .
At the next stage this process is repeated for the new (greater) length li+2 :=
f (ni+1 + |Wi+1 |). So, by induction, it is seen that C = ∞
S
i=1 C i is a prefix code for
which the infinite set M = {li : i = 1, . . . } is a witness for its prefix maximality.
The algorithm depends on the monotonicity of the function f : N → N. The
monotonicity guarantees that, when, at some stage i, the finite approximation Ci
of the code C is constructed, all words w ∈ C \ Ci will have length |w| ≥ f (ni − 1).
References
[1] J. Berstel and D. Perrin. Theory of Codes. Academic Press, 1985.
[2] L.G. Kraft. A Device for Quantizing Grouping and Coding Amplitude Modulated
Pulses, MS Thesis, Electrical Eng. Dept., MIT, Cambridge, Ma., 1949.
[3] M. Li and P.M.B. Vitányi, An Introduction to Kolmogorov Complexity and its Appli-
cations. Springer-Verlag, New York, 1993.
[4] R. Johannesson, Informationstheorie, Addison-Wesley, 1992.