Homework 4 Solution

# Adding an imaginary edge joining p and h to g results

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

This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 9 Now the above (multi)graph G′ is such that all vertices except p and h have odd degrees and a minimum weight walk from p to h using every edge at least once in the original graph will be a walk that uses every edge in G′ exactly once. Adding an imaginary edge joining p and h to G′ results in an Eulerian graph containing an Eulerian circuit C . Removing the imaginary edge from C results in an Eulerian trail W (with endpoint p, h) in G′ . Now W is an optimal walk for our problem. For example, the walk below is one of many diﬀerent correct answers: p, a, b, p, c, d, e, b, c, b, e, d, h, e, a, f, e, i, g, h, i, f, g, f, i, h. Note that an optimal walk should have a total weight of 95. This is obtained by adding the total weight (15) of repeated edges and the total weight (80) of the edges in the original graph. Question 5. (2 points) Exercise 2.3.28. Let S be a set of symbols with relative frequencies of occurrence (out of a total of 55 occurrences) given by the following table: symbol relative frequency a 1 b 2 c 3 d 4 e 5 f 6 g 7 h 8 i 9 j 10 (a) Compute an optimal preﬁx-free code (probably more commonly known as preﬁx code in some areas) for this set of symbols. (b) What is the expected number of 0’s and 1’s in a message containing 1000 of the symbols from S? Solution. (a) We perform the Huﬀman’s procedure and ﬁnd the following binary tree: 1111 0000 1 0 1 0 1111 0000 1 0 1 0 1111 0000 1 0 1111 11 0000 00 1 0 11111 00000 1 11 0 00 1111 1 0000 0 111 000 11111 00000 1 0 1 11 0 00 11111 00000 11 00 1 0 11111 00000 0 11 00 1 11 00 111111 000000 11111 00000 1 0 11 00 11 00 111111 000000 11111 00000 1 0 11 00 11 00 111111 000000 11111 00000 1 0 11 00 111111 000000 11111 00000 12 0 00 1 11 1111111111111111 0000000000000000 00000 11111 00 11 00 11 1 0 111 000 1111 0000 111 000 1111111111111111 0000000000000000 11111 00000 11 00 11 00 1 0 60 111 000 1111 0000 111 000 11111 00000 11 00 1 111 000 1111 0000 1111111111 0000000000 11111 00000 1 111 0 000 111 000 1111 0000 1111111111 0000000000 00000 11111 0 000 1 111 111 000 1111 0000 1111111111 0000000000 11111 00000 1 111 0 000 1111111 0000000 111 000 11 00 111 000 11 111 00 000 11 00 1111111111 0000000000 11111 00000 1 1 0 30 9 1111111 0000000 111 000 11 00 111 000 11 000 0015 11 00 11111 00000 1 0 1 0 1111111 0000000 111 000 11 00 111 000 11 000 00 111 11 00 11111 00000 1111111 0000000 111 000 11 00 111 000 11 000 00 111 11 00 11111 00000 1111111 0000000 111 000 11 00 111 000 11...
View Full Document

## This note was uploaded on 01/13/2014 for the course MAD 5305 taught by Professor Suen during the Spring '12 term at University of South Florida - Tampa.

Ask a homework question - tutors are online