CMPSCI 250: Introduction to Computation
David Mix Barrington
Fall, 2004
CMPSCI 250 Practice Midterm #3
Posted 14 November 2004
Actual midterm will be 18 November 2004
There are four questions for 100 total points.
Question 3(c) corrected 16 November.
When your answer to a problem is a particular number, you may use
exponents, falling exponents, factorials, and/or the "choose" notation
to indicate the number. However, if the answer is less than 100,
you must give the number in ordinary decimal notation for full credit.
Question 1 (20):
A sushi bar sells five kinds of rolls: Alaska, California, Eel,
Salmon, and Tuna. Six customers enter the bar and order one roll each.
- (a,5) In how many ways can each customer pick a type of roll? (Here a
typical selection might be "Customer 1 -- Tuna, Customer 2 -- Eel, Customer
3 -- Tuna, Customer 4 -- Alaska, Customer 5 -- Tuna, Customer 6 -- Eel".)
- (b,5) The order will be reported to the sushi chef as simply the number
of rolls of each type, so that the example above would be "Three Tuna, two
Eel, and an Alaskan". In how many ways could the six rolls be ordered in this
way?
- (c,5) How many possibilities are there for the set
of roll types ordered by the six customers?
- (d,5) In how many ways could the six customers order without two or
more of them ordering the same type of roll?
Question 2 (30):
Let n and k be arbitrary positive naturals with k ≤ n.
- (a,5) How many binary strings of length n have k or fewer ones?
- (b,5) How many binary strings of length n+1 have exactly k ones?
- (c,10) Prove that for any naturals
n and k, the number of binary strings of
length n+1 with k ones equals the number of binary strings of length n with
either k or k-1 ones.
- (d,10) Prove by induction that for all naturals n and k
with k ≤ n,
the number of binary strings of length n with k or fewer ones is greater
than or equal to
the number of binary strings of length n+1 with exactly k ones.
(Hint: Let n be arbitary and use induction on k, starting with k=1.)
Question 3 (30):
If n and k are any naturals, define h(n,k) to be the number of subsets of
the set {1,...,n} of size k that do not contain two adjacent numbers.
For example, h(4,2) = 3 because the relevant sets are {1,3}, {1,4}, and {2,4}.
The other three subsets of size 2 contain two adjacent numbers.
- (a,10) Explain why h(n,0) = 1, h(n,1) = n, and h(n,2) = (n-1 choose 2).
- (b,5) Explain why h(n,k) = 0 if n is even and k > n/2.
- (c,15) Prove that h(n,k) = (n choose 2k-1) for all n and k.
Sorry! The correct number is (n-k+1 choose k).. (Hint:
Define and justify a bijection from the no-adjacent element sets of size
k from {1,...,n} and all the sets of size k from
{1,...,n-k+1}. You can also prove this by induction.)
Question 4 (20):
The word "CAMBRIDGE" consists of nine different letters.
- (a,5) How many three-letter strings can be formed from the letters
of "CAMBRIDGE" without repeating a letter?
- (b,5) If I choose one of the three-letter strings at random,
what is the probability that I get one whose letters are in alphabetical
order, as in the string "AIM"?
- (c,10) If I divide the nine letters into three three-letter strings
with every division and every order of the strings
being equally likely, what is the expected number of
strings that will have their letters in alphabetical order? Justify your
answer.
Last modified 16 November 2004