proofKraftMcMillan

# proofKraftMcMillan - If the root of T is a preﬁx and the...

This preview shows page 1. Sign up to view the full content.

Proof of the Kraft-McMillan Inequality 26th October 2001 Peter J. Taylor Andrew D. Rogers Consider a set of codewords C 1 , C 2 , . . . , C N of lengths n 1 , n 2 , . . . , n N , such that: n 1 n 2 . . . n N Now consider the ﬁnite binary tree representing these codes, T C . Some of the nodes are labelled as codewords. We have the restriction that the subtree rooted at a codeword contains only that one codeword. Tripartition the nodes of the tree into codewords, preﬁxes and NCPs (Neither Codeword nor Preﬁx). If the subtree rooted at node X contains at least one codeword, and X is not a codeword, then X is a preﬁx. If the subtree rooted at X contains no codewords at all, X is an NCP. Now deﬁne: d i, T def = ± depth of node C i in tree T C i T 0 C i / T Deﬁne the cost, C(T), of the tree T as: C(T) def = X i ∈{ j N C j T } 1 2 d i, T If the root of T is a codeword, C(T) = 1, by deﬁnitions of codeword and C. If the root of T is an NCP, C(T) = 0, by deﬁnitions of NCP and C.
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: If the root of T is a preﬁx, and the subtrees are T 1 and T 2 , then: C(T) = (C(T 1 ) + C(T 2 )) / 2 (as d i, T = d i, T 1 + 1 for i ∈ { j ∈ N C j ∈ T 1 } , d i, T = d i, T 2 + 1 for i ∈ { k ∈ N C k ∈ T 2 } and ( C i ∈ T) ⇒ ( C i ∈ T 1 ) ⊕ ( C i ∈ T 2 ) ). Then by structural induction on a ﬁnite tree T, C(T) ≤ 1. Case 1: The root of T is a codeword. Then C(T) = 1 Case 2: The root of T is an NCP. Then C(T) = 0 Case 3: The root of T is a preﬁx, and the subtrees are T 1 and T 2 . By the inductive hypothesis, C(T 1 ) ≤ 1 and C(T 2 ) ≤ 1. Therefore C(T) = (C(T 1 ) + C(T 2 )) / 2 ≤ 1. 2 Therefore: C(T) = X i ∈{ j ∈ N C j ∈ T } 1 2 d i, T ≤ 1 But for T C , { j ∈ N C j ∈ T C } = { 1 , 2 , . . . , N } and d i, T C = n i , so: X 1 ≤ i ≤ N 1 2 n i = C(T C ) ≤ 1 X i 1 2 n i ≤ 1 2...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online