Discrete Exam2
Discrete Exam2
Directions:
Form AC 1 of 10
For multiple choice (A, B, C, etc.), circle the letters of all correct choices. For TRUE/FALSE, circle the
word TRUE or the word FALSE. Otherwise follow the directions given.
I would prefer answers be left as an unevaluated formula than a giant number of any accuracy. Im not
testing your ability to type into the calculator and copy the answer back off, after all, but rather your
ability to use the correct formula(s) for the situation and fill in the main variables to get it started.
Work easier problems first. Write out your plan for harder problems before beginning them.
Note that the last two pages are bonus!
1) You are given a choice of six algorithms to solve a particular problem. The algorithms performances
are measured in terms as log2 pnq, n, n log2 pnq, n2 , n3 , and 2n . If you have 30 seconds available to
run your program on a machine that requires a microsecond per instruction, what size data set could
be processed with each algorithm?
Knowing now all this mathematical information, what further factors (from the list below) will influence
your choice of algorithm in the application?
A) average IQ of the user
ii)
npn ` 1q
2
iv)
npn 1q 2
p6n ` log2 pnqq
4
for i = 1 to n
for j = 1 to m
cij = 0
for k = 1 to p
cij = cij + aik * bkj
ii) The critical operations are the additions to total and sum. For the big- part, assume w y.
for i = 0 to w
for j = 0 to i
total = total + purchase{ij}
for k = 1 to y
sum = sum + (total / k)
4) Assuming that there will never be more than 500 million people in the United States before the year
2050 A.D., how many digits are necessary to provide every person with a personal zip code? (Notice
that businesses and institutions are being neglected in this count.)
5) An individual won a raffle and can choose a prize from one of four lists. The first list contains 19
possible prizes while the second, third, and fourth lists include 14, 21, and 18 items, respectively. How
many prizes does the raffle winner have to choose from?
6) A local pizza store offers a choice of seven toppings. How many distinct three-topping pizzas do they
offer if no topping can be repeated?
7) Suppose you are taking a bus trip from your home in Florida to California. There are seven different bus
services offering trips from Florida to Arizona, four offering trips from Florida to Texas, eight offering
trips from Arizona to California, and seven offering trips from Texas to California. How many possibilities
are there for a bus ride from Florida to California, via either Arizona or Texas?
Form AC 3 of 10
9) A piano has 88 keys. A pianist plays a chord by striking multiple distinct keys simultaneously.
i) Assuming that your fingers are made of rubber and it was therefore possible to reach any 10-key
chord, how many such chords are there?
ii) A standard octave contains 12 keys. Triad chords require three keys to be struck simultaneously.
Ignoring how agreeable the sound will be, in how many ways can a triad be played within a single
octave?
10) In 1992, the Mattel toy company introduced a talking Teen Barbie doll. The company had compiled a
collection of 270 possible expressions for Barbie to speak. To make the dolls appear more individually
distinct, Mattel randomly chose four of the 270 possibilities for any particular doll.
i) How many distinct dolls could they manufacture?
ii) Suppose one of the 270 statements is considered to be undesirable1. How many distinct dolls
contain the undesirable statement among their four exclamations?
11) A fletcher is making some arrows. Each arrow has three feathers on the tail end spaced at 120
intervals around the shaft. The feathers come in four colors: red, blue, yellow, and green. How many
visually distinct patterns are there if a color can be used in more than one position on an arrow?
Assume that rotating the arrow in any direction (including end-to-end) does not result in a different
pattern, but changing colors does.
Perhaps a disgruntled employee slipped in a substitute statement before being carried off the premises and no one noticed it
amongst the 269 others during a routine scan or any of their testing.
13) Mrs. Candy has a large box of lollipops, chocolate bars, and caramels. She wants to give each of the
nine children in her neighborhood three pieces of candy. Taking into account that each type of candy
is available in a quantity greater than 30, in how many ways can Mrs. Candy distribute the candy?
Why did the author feel it necessary for Mrs. Candy to have a quantity greater than 30 of each type of
candy for this to go well?
15) James and a friend played 14 games of tic-tac-toe one night. In how many ways can James end the
night with eight wins, two ties, and four losses?
16) Suppose that you must choose a password at your work that is five to seven characters long. How
many possible passwords are there if:
i) each password can be any combination of alphanumeric characters?
ii) each password must contain at least one digit? (The remaining characters are still able to be any
alphanumeric value.)
17) DNA consists of the four nucleotides: A (adenine), C (cytosine), G (guanine), and T (thymine). The
DNA strands AAG and AGA are considered to be distinct. Count the number of distinct DNA strands
that consist of 3A, 2C, 4G, and 2T.
19) How many different five-card hands are there that contain a straight?2 (A straight occurs when the five
cards have five consecutive fact values. One example of a straight is 8-9-10-jack-queen. Note that the
ace can be used as either the lowest card or the highest card in a straight.)
20) How many different eight-card hands are there with no more than three red cards?
21) What is the difference between versions 1 and 2 of the multinomial counting theorem?
k0
n`1
r`1
(Hint: Prove the assertion directly for n r and then use mathematical induction on n to prove the
assertion when 0 r n.)
n`1
r`k
r`1
r
k0
(Hint: Maybe Corollary 5.18 the backward hockey-stick theorem can be of help?)
25) How many people need to be gathered to guarantee that at least two have birthdays in the same
month? Please explain your reasoning.
27) A group of twelve people have gathered for dinner. There are nine U.S. citizens, seven adults, and four
who read science fiction. There are five U.S. citizens who are adults and three U.S. citizens who read
science fiction. Only three of the adults read science fiction and only two of these adult science fiction
readers are U.S. citizens. How many of the children are neither U.S. citizens nor readers of science
fiction?
28) Use inclusion-exclusion to calculate the number of bit strings of length 9 that either begin with two 0s,
have eight consecutive 0s, or end with a 1 bit.
Bonus Problems:
29) You notice these two problems in the book: 5.2.3.1 and 5.2.3.20. Explain how they are really the same
problem. (Tip: The hint on #20 is misleading and unnecessary.)
n k
2 3n
k
k0
A) says that we can never tell if a particular program stops given a specific input
B) says that we can never tell if an arbitrary program stops given a specific input
C) says that we can never tell if a particular program stops given any input
D) says that we can never tell if an arbitrary program stops given any input
E) is about the appropriate breaking distance of a moving vehicle
Start Date: F Apr 3
ii) Use the full Boyer-Moore algorithm. Show j LrT i` j1 s. Indicate which table determines each
shift.