Assigned:
Wed 16 Sep 2009
Due:
Wed 23 Sep 2009
Problem | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | ... |
---|---|---|---|---|---|---|---|---|---|---|
Credit | RC | RC | RC | EC | RC | RC | NA | RC | RC | ... |
where "RC" is "regular credit", "EC" is "extra credit", and "NA" is "not applicable" (not attempted). Failure to do so will result in an arbitrary set of problems being graded for regular credit, no problems being graded for extra credit, and a five percent penalty assessment.
Required: Do any 5 of the following 7 problems.
Points: Problems are worh 20 point each.
Unless otherwise indicated, problems are from Algorithms by Dasgupta, Papadimitriou, and Vazirani.
Digital transmission protocols transmit signals using binary codes. In order to minimize the effect of errors, it is often useful to select a code such that "similar" signals use "similar"' codewords.
One such code is a list of 2nn-bit strings in which each string (except the first) differs from the previous one in exactly one bit. Let us call such a list a twiddling list since we go from one string to the next by just flipping one bit.
Consider the following recursive algorithm for listing the n-bit
strings of a twiddling list. If n = 1, the list is 0,1. If n > 1, first take a twiddling list of (n-1)-bit strings, and place a 0
in front of each string. Then, take a second copy of the twiddling
list of (n-1)-bit strings, place a 1 in front of each string,
reverse the order of the strings and place it after the first list.
So, for example, for n = 2, the list is 00,01,11,10, and for n=3,
we get 000,001,011,010,110,111,101,100.
Prove by induction on n that
(a) every n-bit string appears exactly once in the list generated by the algorithm, and
(b) each string (except the first) differs from the previous one in exactly one bit.