






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
This is a closed book exam for cs 173 with 13 problems covering various topics in combinatorics, recursion, and mathematical induction. It includes multiple-choice questions, short answer problems, and a recursive function definition. The problems require a solid understanding of set theory, counting principles, and mathematical proof techniques.
Typology: Exams
1 / 11
This page cannot be seen from the preview
Don't miss anything!
Name:
NetID:
Lecture Section: 9:30a, 11:00a (circle one)
Section Leader:
General Directions
What is n if C(n, 3) = P (n, 2)?
a) (^196)
b) 8
c) There is no positive value of n that makes this equation true.
d) Some other positive value of n makes this equation true.
Solution: (^) (n−n3)!3!! = (^) (n−n!2)! ⇒ n(n−1)( 6 n−2)= n(n 2 − 1)⇒ n(n − 1) n− 6 8 = 0 (b)
What is the coefficient of x^5 in (3x + 12 )^8?
a) 21
b) (^42 )
c) (^354 )
d) 1701
Solution:
8
(d)
A box contains 10 French books, 20 Spanish books, 8 German books, 15 Russian books, and 25 Italian books. Suppose we randomly select books from boxes so that each book is equally likely to be chosen. How many books must we choose from the boxes in order to be sure of choosing 12 books of the same language?
a) 52
b) 56
c) 57
d) 60
Solution: In the worst case, we choose one from each kind until German books are all chosen. Then choose one from each remaining kind until French books are eliminated. Then, do it again until the number of a certain kind reaches
A sushi bar sells five kinds of rolls, and you want to eat nine rolls for dinner. How many different sushi dinners do you have to choose from if you must have one roll of each type? (Note, the arrangement of the sushi on your plate is irrelevant.)
a) 54
b) 59
c) 9!4!
d)
4
Solution: basically you select 4 sushi rolls: 54. (a)
At a party, each card in a standard deck of 52 unique cards is torn in half and both halves are placed in a box. Two guests each draw a half-card from the box. What is the probability they draw 2 halves of the same card?
a) 521
b) 2061
c) 1031
d) 10352
Solution: Randomly choose one from a box, the chance that its other half is drawn from the other box is 521. (a)
A directory on a computer’s hard drive contains 12 files, 3 of which are corrupted by a virus. If a corrupted file is selected, the virus is removed and another file is selected at random from the 12 files. That is, a file may be accessed more than once, but after the first time, it is certainly not corrupt.
Find the probability that exactly three selections are made until an uncorrupted file is chosen. In other words, find the probability the first two selections are corrupted, and the third is not.
a) 1
b) 28811
c) 643
d) 4
Solution: 3 / 12 ∗ 2 / 12 ∗ 11 /12 = 11/ 288 (b)
Define a recursive function listmax() whose input is a finite set of integers Ln = {x 1 , x 2 ,... , xn} with n ≥ 2 , and whose output is the maximum element in the set. You may assume the existence of a function max({a, b}) whose input is a list of length 2, and whose output is the maximum element of the list.
Solution:
function listMax(list l) if(l.length==1) return l[0]; else return max(l[0],listMax(l.removeFirstElement())
Grading rubric: 2 points for stopping condition. 8 points recusrive formula. 1 point out of 10 for nonrecursive solution.
Consider the Fibonacci Sequence: f 0 = 0, f 1 = 1, and fn = fn− 1 + fn− 2 , for n ≥ 2. In this problem you will prove that fn > A · ( 32 )n^ when n ≥ 1 , for some constant A.
a) Find a value of A that makes the expression true.
b) As the base case of an inductive argument, prove that f 1 > A · 32 and f 2 > A · ( 32 )^2 , where A is the value you chose in part a). (Think about why both these base cases are necessary.)
c) Complete the proof by induction.
a) f 1 = 1 > 32 A ⇒ A < (^23) f 2 = f 0 + f 1 = 1 > 94 A ⇒ A < (^49) Try A = 13.
b) f 1 = 1 > 32 × 13 = 12 ⇒ True f 2 = f 0 + f 1 = 1 > 94 × 13 = 34 ⇒ True
c) Inductive Hypothesis: Assume for 1 ≤ k ≤ n, it is true that fk > 13 · ( 32 )k^ (Since you have two base cases, it is also correct if you assume only for k = n − 1 and k = n, it is true that fk > 13 · ( 32 )k). Inductive Step: For k = n + 1, fn+1 = fn + fn− 1 > 13 · ( 32 )n^ + 13 · ( 32 )n−^1 = ( 13 + 29 )( 32 )n^ = 59 ( 32 )n^ = 1027 ( 32 )n+1^ > 13 ( 32 )n+
a) 2 points.
b) 2 points.
c) 6 points. No IH or seriously flawed inductive step: -3 or -4 points; IH not strong enough (only assumes k=n is true, etc.): -2 points Minor errors: -1 or -2 points
You are most likely getting hungry by now, so we’re going to count sandwiches. Suppose the local Freeway Sandwich Shop has 6 different kinds of meat, 3 different kinds of cheese, 12 different kinds of vegetable, and 2 different kinds of bread. Note that because of our discriminating tastes, sandwiches whose ingredients are stacked in different orders are considered to be different sandwiches, even if the ingredient list is the same. Moreover, the sandwich makers at Freeway are very good–they always remember to put the bread on the outside of the sandwich. DON’T FORGET THESE FACTS!
a) Suppose you want a cheese (only) sandwich on white bread. How many different sandwiches do you have to choose from if you want 6 slices of cheese? (Duplicate cheese slice types are allowed.)
b) If you randomly choose sandwiches like those in part a), how many different sandwiches would you have to choose in order to assure that you choose at least 3 that are exactly the same?
c) How many different sandwiches can be made from 3 slices of turkey, 2 slices of cheddar cheese, and one onion (a vegetable)? (Don’t forget to think about the bread!)
d) If you prefer that your sandwiches be stacked in order–meats first, then cheeses, then veggies–how many italian- bread sandwiches consist of a stack of 3 different meats, followed by 2 different cheeses, followed by one veggie?
e) How many of the sandwiches you counted in part d) have stacks that begin with turkey and roast beef?
f) What is the probability of selecting a sandwich like those in part e) if you choose one randomly from those in part d)?