proofKraftMcMillan - If the root of T is a prefix, and the...

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

View Full Document Right Arrow Icon
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 finite 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, prefixes and NCPs (Neither Codeword nor Prefix). If the subtree rooted at node X contains at least one codeword, and X is not a codeword, then X is a prefix. If the subtree rooted at X contains no codewords at all, X is an NCP. Now define: d i, T def = ± depth of node C i in tree T C i T 0 C i / T Define 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 definitions of codeword and C. If the root of T is an NCP, C(T) = 0, by definitions of NCP and C.
Background image of page 1
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 prefix, 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 finite 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 prefix, 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

This note was uploaded on 01/26/2010 for the course COMPUTER S 15-853 taught by Professor Guyblelloch during the Fall '09 term at Carnegie Mellon.

Ask a homework question - tutors are online