CMPSCI 250: Introduction to Computation

David Mix Barrington

Spring, 2006

Homework #6 Questions and Answers

Question 6.2, 25 April 2006

We were getting bored and frustrated working out all the cases for the Risk problem (Problem 7.6.3) and thought of counting all the cases with a computer program. Is this all right?

Sure, it's a sensible approach. The main problem is being sure that your code is accurately counting all the cases. There are solutions to this problem claimed on the internet...

Question 6.1, 23 April 2006

In Problem 6.7.5, I think there may be a typo. I think that f(n,k) equals (2n choose k), but this makes the recurrence f(n,k) = f(n,k-1) + 2f(n-1,k-1) + f(n-1,k-2). You have the same recurrence but without the "2".

Your theory about (2n choose k) is reasonable but wrong. Let's look at f(3,3). This is the number of multisets of size 3 from {a,b,c}. Writing them as sorted strings for convenience, there are 7 of these: aab, aac, abb, abc, acc, bbc, and bcc. Your theory would give (6 choose 3) = 20. The reason for this is that when you take k items from a set containing two copies of each letter (which is how you got your formula) you count the same multiset more than once. If there are two different a's, two different b's, and two different c's, for example, you have eight different versions of the multiset "abc" and you are counting them separately.

Last modified 25 April 2006