Exam 3 - Piazza

CSC 1300-­β€003 Discrete Structures Exam 3 April 14, 2015
Name:_____KEY___________ Question Value Score 1 2 3 10 30 30 4 20 5 10 TOTAL 100 No calculators or any reference except your one note card is permitted. If an answer
involves a computation that would be very time consuming, you may leave it in a form
that just needs final calculation.
Please answer questions in the spaces provided. If you make a mistake or for some other
reason need more space, please use the back of pages and clearly indicate where the
answer can be found.
Show your work carefully. Just writing an answer will not do. Show any assumptions,
show the steps you took, and show how you came to your answer.
Good luck!
CSC 1300 Discrete Structures
Dr. Papalaskari
Spring 2015
1. [
/10] Show, using induction that for any n ∈ β„•,
𝐴! βˆͺ 𝐴! βˆͺ β‹― 𝐴! = 𝐴! ∩ 𝐴! ∩ β‹― 𝐴!
CSC 1300 Discrete Structures
Dr. Papalaskari
Spring 2015
2. [
/30] a. [
/5] There are 20 plants in your garden but only enough fertilizer spray to
boost 8 of them. How many ways are there to fertilize the plants?
Answer: C(20,8) = 125,970.
b. [
/5] How many anagrams are there (including those that aren’t dictionary
words) of PIES?
Answer: All four letters are different, so 4! = 24 anagrams.
c. [
/5] At the ice cream store, you need to get 20 quarts of ice cream of assorted flavors for a big Fourth of July block party. There are 15 possible flavors to choose from and you can choose any number of quarts of each flavor (including zero). How many ways are there to choose the flavors? Place 20 slots in a line to indicate the 20 quarts, and place 14 dividers to indicate switches
between flavors of ice cream. That gives C(20+14, 14) = C(34,14) possibilities for where
the dividers would go.
For the remaining questions, consider words made of the alphabet A, B, C, D, E, F.
d. [
/5] How many four-letter words contain the subword ACE?
Answer: A four-letter word containing ACE has only one other letter in it. That letter
can occur at the beginning of the word or the end of the word, and there are six
possibilities for that letter. Thus, there are 2 · 6 = 12 words containing ACE.
e. [
/5] How many five-letter words contain the subword CAB?
Answer: We can have words of three forms:
– – CAB
– CAB –
CAB – –
For each of these three possibilities, we have six choices for each of the two remaining
letters. Thus, the total number is 3 · 62 = 108.
f. [
/5] How many four-letter words begin with C or end in two vowels?
Answer: If a four-letter word begins with C, then there are six choices for each of the
other three letters and so there are 63= 216 such words.
If a four-letter word ends in two vowels, there are six choices of letter for the first
two letters and two choices of letter (A or E) for the last two letters, for a total of
6 · 6 · 2 · 2 = 144 words.
This double-counts those words that begin with C and end in two vowels. There are 6 ·
4 = 24 such words because there are one, six, two, and two choices for the word’s
four letters, respectively.
Thus, there are 216 + 144 βˆ’ 24 = 336 four-letter words that begin with C or end in two
vowels.
CSC 1300 Discrete Structures
Dr. Papalaskari
Spring 2015
3. [
a. [
/5] Recall that the Fibonacci sequence is defined by the recurrence
Fn = Fnβˆ’1 + Fnβˆ’2 with initial conditions F0 = 0 and F1 = 1. Write out the three Fibonacci numbers after 34 and 55. After 34, 55:
89, 144, 233 b. [
/10] Consider binary numbers with n digits (e.g., 1010, 00101, 011). How many
binary numbers of length n do not contain the substring 000? Denote this number by zn ; find a
relationship between zn , znβˆ’1 , and (we’re not going to tell you) in order to form an appropriate recurrence
relation. DO NOT try to find a closed form, just write the recurrence and initial conditions and
be sure to explain your reasoning.
Answer: Binary numbers with n digits can be categorized into disjoint sets as follows by
considering their start bits. They may start with 1 or 0, but if they start with 0, that cannot be
part of a 000 group, so it needs to continue as 01xxx…. or 001xx…. (note that 01xxx… covers
both the cases of 010xx… and 011xx…). To summarize, we have the following possibilities:
β€’
β€’
β€’
start with 1 => there are 𝑧!!! of these that do not contain 000
start with 01 => there are 𝑧!!! of these that do not contain 000
start with 001 => there are 𝑧!!! of these that do not contain 000
No other possibilities exist, and these sets are disjoint, so the sum rule applies and we have the
recurrence: 𝑧! = 𝑧!!! + 𝑧!!! + 𝑧!!! .
[alternatively, you can think of analyzing this in terms of ending in 1, 10, or 100]
Initial conditions: 𝑧! = 1, 𝑧! = 2, and 𝑧! = 4. Sequence: 1, 2, 4, 7, 13, 24, 44, . . . .
c. [
/15] Find a closed form for the recurrence an = -2anβˆ’1 + 3anβˆ’2 ,
with initial conditions a0 = 9, a1 = -7. Verify your solution for n = 0, 1, 2, 3.
Characteristic equation is x2+2x βˆ’3 = 0 with roots x1=-3 and x2=1, so the
closed form is an = q1 (3)n + q2 (1)n
Using initial conditions: a0 = 9 = q1 + q2 so q1 = 9 βˆ’q2 ;
a1 = -7 = -3q1 + q2 = -3(9 βˆ’q2 )+ q2 so q2 = 5 and q1 = 4
Thus the closed form is:
π‘Ž! = 4 βˆ’3)! + 5 n an = -2anβˆ’1 + 3anβˆ’2 0 9 1 -­β€7 2 14+ 27=41 CSC 1300 Discrete Structures
3 -­β€82-­β€21=-­β€103 π‘Ž! = 4 βˆ’3)! + 5 4+5 = 9 4(-­β€3)+5 = -­β€7 4(9)+5=41 Dr. Papalaskari
4(-­β€27)+5=103 Spring 2015
/30] 4. [
a) [
/5] Suppose a graph G has 365 vertices and 364 edges. Can it be a tree? Must it be a tree? Yes, it can be a tree – as long as it is connected. If it is not connected, it might have cycles, so it is not necessarily a tree. b) [
/5] Draw all trees of five vertices.
c) [
/5] Does every bipartite graph have a perfect matching? Answer: No. Consider a bipartite graph with one vertex in the first part and two vertices
in the second part.
d) [
/5] Make a binary search tree for this list of words. Place the first item shown at the root. Insert the other items in the order in which they appear. it, is, never, too, late, to, have, a, happy, childhood CSC 1300 Discrete Structures
Dr. Papalaskari
Spring 2015
/20] 5. [
/10] Find the minimum spanning tree. Show your individual steps, i.e., keep redrawing what you have done before, to show how the spanning tree evolves. CSC 1300 Discrete Structures
Dr. Papalaskari
Spring 2015
For your reference, as needed:
CSC 1300 Discrete Structures
Dr. Papalaskari
Spring 2015