CMPSCI 250: Introduction to Computation

David Mix Barrington

Spring, 2005

Homework #5 Questions and Answers

Question 5.2, 10 April 2005

In Problem 6.3.4, I don't understand why the strings are divided into 111XXXXXXX, 0111XXXXXX, X0111XXXXX, ..., XXXXXX0111 instead of 111XXXXXXX, X111XXXXXX, XX111XXXXX, ..., XXXXXXX111. The latter division makes much more sense to me.

It makes more sense to me as well, but there is a good reason to use the less intuitive breakdown I gave you. If you use your breakdown for eight-set inclusion/exclusion, lots of the combinations of sets have nonempty intersections and the calculation gets very complicated. With the breakdown I suggest, most of the combinations have empty intersections and most of the terms that appear in the inclusion/exclusion calculation are zero.

Do you see why every string with a "111" is in one of my eight sets? Once you have counted 111XXXXXXX, you have already counted the strings in X111XXXXXX that start with a 1, so you can restrict yourself to 0111XXXXXX. Then once you have 111XXXXXXX and 0111XXXXXX, you already have the strings in X1111XXXXX, so you can count X0111XXXXX instead of XX111XXXXX.

Note that a perfectly correct way to solve this problem is to write a Java program that iterates through all 1024 binary strings of length 10, checks each one for the presence of a 111 substring, and counts the ones that have it.

Question 5.1, 6 April 2005

In 6.6.4 (e), you say that a hand with three of one kind and two other pairs (call this "AAABBCC") and a hand with two different three-of-a-kinds (call this "AAABBBC") are to be considered full houses. What about "AAABBCD" -- is that a full house? Is it true that three of one kind, two of another, and any two other cards constitute a full house?

There are three kinds of full houses under these rules, what you are calling AAABBCD, AAABBCC, and AAABBBC. It is not true that anything of the form AAABBXX is a full house, because if the X's include a fourth A or two B's, you have AAAABBX or AAABBBB, and each of these hands is considered four of a kind rather than a full house.

The basic rule is that you look at all the five-card subsets of a seven-card hand, and choose the one that gives you the highest-ranking hand.

Last modified 6 April 2005