
1. Given the following coding scheme, find the word represented by the given
   encodings. (Taken from Rosen Discrete Math text.)
      a: 001      b: 0001      e: 1     r: 0000
      s: 0100     t: 011       x: 01010
   (a) 011 1 0100 011    test
   (b) 0001 1 1 0000     beer
   (c) 0100 1 01010      sex
   (d) 011 001 01010     tax

2. Show the Huffman tree that results form the following distribution
   of punctuation characters and digits.  Frequency is in parentheses.
      colon(100), space(605), newline(100), comma(705),
      0(431), 1(242), 2(176), 3(59), 4(185),
      5(250), 6(174), 7(199), 8(205), 9(217).  

Continually find the two smallest frequencies. Always put smallest on left.

min2                                    min1
 |                                       |
100    605    100    705  431  242  176  59  185  250  174  199  205  217
colon space newline comma  0    1    2    3   4    5    6    7    8    9

   min2          min1
    |             |
   159    605    100    705  431  242  176  185  250  174  199  205  217
   / \   space newline comma  0    1    2    4    5    6    7    8    9
  /   \
 3   colon

                                     min2          min1
                                      |             |
       259      605   705  431  242  176  185  250  174  199  205  217
       / \     space comma  0    1    2    4    5    6    7    8    9
      /   \
 newline   159
           / \
          /   \
         3   colon

                                              min1      min2
                                               |         |
       259      605   705  431  242    350    185  250  199  205  217
       / \     space comma  0    1     / \     4    5    7    8    9
      /   \                           /   \
 newline   159                       6     2
           / \
          /   \
         3   colon
                                                             min1  min2
                                                              |     |
       259      605   705  431  242    350       384   250   205   217
       / \     space comma  0    1     / \       / \    5     8     9
      /   \                           /   \     /   \
 newline   159                       6     2   4     7
           / \
          /   \
         3   colon

                                min1                   min2
                                 |                      |
       259      605   705  431  242    350       384   250      422
       / \     space comma  0    1     / \       / \    5       / \
      /   \                           /   \     /   \          /   \
 newline   159                       6     2   4     7        8     9
           / \
          /   \
         3   colon


       min1                                 min2
        |                                    |
       259      605   705  431    492       350       384        422
       / \     space comma  0     / \       / \       / \        / \
      /   \                      /   \     /   \     /   \      /   \
 newline   159                  1     5   6     2   4     7    8     9
           / \
          /   \
         3   colon

                                                       min1       min2
                                                        |          |
            609            605   705  431    492       384        422
          /     \         space comma  0     / \       / \        / \
         /       \                          /   \     /   \      /   \
       259        350                      1     5   4     7    8     9
       / \        / \
      /   \      /   \
 newline   159  6     2
           / \
          /   \
         3   colon                  

                                      min1   min2
                                       |      |
            609            605   705  431    492            806
          /     \         space comma  0     / \          /     \
         /       \                          /   \        /       \
       259        350                      1     5     384       422 
       / \        / \                                  / \       / \
      /   \      /   \                                /   \     /   \
 newline   159  6     2                              4     7   8     9 
           / \
          /   \
         3   colon                  

And so on ... the final tree is:

                             .
                      /             \
                   /                   \
                 /                       \
             .                              .
            /  \                     /            \
           /    \                  /                \
      comma      .                .                   .
              /    \             /  \              /      \
             /      \           /    \            /        \
            .        .         0      .        space        .
           / \      / \              / \                  /    \
          /   \    /   \            /   \                /      \
         4     7  8     9          1     5              .        .
                                                      / \       / \
                                                     /   \     /   \
                                                 newline  .   6     2
                                                         / \
                                                        /   \
                                                       3    colon

Assign the Huffman codes with left edges getting zero, right getting one.
  colon    111011
  space    110
  newline  11100
  comma    00
   0       100
   1       1010
   2       11111
   3       111010
   4       0100
   5       1011       
   6       11110
   7       0101
   8       0110
   9       0111
