CompSci 267 Homework set #2

  1. Consider the following two codings with source alphabet {a,b,c,d,e,f} and code alphabet {0,1}. For each code,
                    a b c d e f
    code 1 01 011 10 1000 0011 0111
    code 2 1010 001 101 0001 1101 1011

     
  2. A full binary tree is right justified if, at each level of the tree, all the nonterminal vertices appear to the right of all the leaf vertices. Show that there must be a lossless encoding method which employs fewer than 0.85N codebits to encode each right justified tree having N leaves, if N is sufficiently large.
     
     
  3. Compact codes come from conservative expansions of a trivial code.
     
  4. Consider the following generalization of Shannon-Fano coding to create a binary codetree for the set S of words {wi} with associated probabilities {pi}:


     
     
  5. Use (a) Shannon's method of coding, (b) Shannon-Fano coding, and (c) Huffman coding,
    to determine the average codelength of (1) a binary code, and (2) a ternary code,
    for a source having symbol probability distribution
    .22, .2, .18, .15, .1, .08, .07.