Here are questions and answers on HW#5, due 24 October 2003. Questions are in black, answers in blue.

I'm a little confused by the wording on problem 5.6.1.a. Is the question asking how much n decreases by? (i.e. the loop stops at n=0, so it decreases by n) Is it asking how much n decrease each iteration? (i.e. n - (m mod n), so decreases by a number between n and 1) Or is it asking something else entirely different?

I read it as "how much can the second parameter decrease in a single iteration of Euclid's algorithm". That is, the orginal call to gcd(m,n) gives rise to a recursive call to gcd(a,b) for some a and b. The question is how small b might be with respect to n. Could b be 0? Could it be 1? Must it always be at least some fraction of n?

For the Josephus Problem, 5.5.9 part b, are we supposed to figure out a pattern that applies for all values of n or just some values of n? (because it seems there are patterns that apply to certain values of n, but not all values of n)

You need a rule that applies to all values of n, though this rule may have cases in it, e.g., "if n is a power of two, J(n) = 1, otherwise J(n) = ....". You then want to prove, probably by strong induction on n, that for all n, J(n) equals the number given by your rule. The main step of this will be showing that your rule follows the base case and two recurrence rules that Levitin derives for J(n).

If you're not sure you have the correct values of J(n), you can check them against the "one-bit cyclic shift" rule described at the very end of the section just before the exercises.

The Fake-Coin problem presented in the book says that we should assume the fake coin is lighter. I just wanted to make sure that this w true for the proof as well, that we know the relationship of the fake coin's weight to a normal coins.

Yes, absolutely. The lower bound is for the same problem as the upper bound. And if you don't know whether the fake coin is lighter or heavier, the problem becomes quite different -- you can't do even two coins in one weighing. (This is a good new problem to think about for the future...)

For problem 5.5.3 - when we are designing the algorithm, can I assume that I can weigh individual coins even if I'm not down to the base case? (I am asking this because it would affect the types of comparisons I would make when dividing into 3 piles, since there are possible remainders of 1 or 2 coins when dividing into 3 parts. Specifically, when I get a remainder of 1 coin after dividing a set by 3, am I allowed to weigh that coin against an individual coin from one of the 3 divided piles?... or am I only allowed, at that stage, to weigh piles against piles?)

There is no reason a "pile" cannot consist of one coin.
So you *may indeed* put one coin on each side of the balance, and
choose those coins in any way based on their previous history.

Sorry, I am confused on the questions on HW5. The one that says Question B5.1. Is the question that one that you asked right on that same page as the homework? Or is the question actually located in the book? Sorry to ask this question.

Sorry, the question is the one stated right there on my assignment page, which is to prove the lower bound matching 5.5.3. I needed a name for the problem and chose "B5.1" to mean "first Barrington problem on HW#5", sorry again for the confusion this caused you.

I've gotten an early start on HW5 and I was wondering about question B5.1 (prove three piles is optimal for coin-weighing).

Is it sufficient to prove that no similar algorithm for dividing the pile of coins into more piles (i.e. 5 piles on each iteration) will do better? Or should I write out an adversary-type argument that no other algorithm will do better than splitting into equal piles and comparing them to each other _and_ that 3 is also the optimal number?

You must prove that no other algorithm that uses coin weighings as specified (equal numbers of coins on each side of the scale) can use fewer weighings (e.g., two weighings for 27 coins) and be correct in all circumstances. Your adversary argument must deal with any sets of equal numbers of coins on each side --e.g., your opppenene picks the sets, then you decide where the bad coin is.

Last modified 23 October 2003