Professional Documents
Culture Documents
ICSI210 Practice Final
ICSI210 Practice Final
1. (10 points) Let m be an integer > 1, and let k be an integer. Recall that the residue of k
mod m is the unique integer in the set {0, 1, 2, ..., m − 1} that is congruent to k modulo m.
Compute the following residues:
1. [11]10 .
2. [−8]6 .
3. [2]3 .
4. [0]12 .
Note what we did here: we noticed that 27q ≡ 0( mod 27), so that we’re just left
with k ≡ 9r.
If r = 0, then k ≡ 0( mod 27). If r = 1, then k ≡ 9( mod 27). Finally, if r = 2, then k ≡ 18(
mod 27). Thus, the only possible values for h(k) are 0, 9, and 18, as desired.
Addendum: Why did we choose to split into cases based on the remainder of ` divided by
3? We chose 3 in particular because k = 9`, and 9 · 3 = 27, which is the size of the array,
and hence the modulus that we’re working with. This implies that h(k) = 9r, where r is the
remainder of ` divided by 3. If I had chosen some other modulus, such as 81, then we would
consider the remainder of ` divided by 81/9 = 9.
3. (10 points) Suppose that p is a prime number > 2. Suppose that m is a number such that
gcd(m, p) > 1. What must be true about m?
Solution:
Since gcd(m, p) > 1, this implies that m and p both have a common factor other than 1. Since
the only factors of p are 1 and itself, this implies that m has p as a factor. In other words, m
is a multiple of p.
ICSI 210 PRACTICE Final Exam SOLUTIONS Page 2 of 3
4. (10 points) Suppose that a sandwich shop allows customers to build a sandwich by choosing
one out of each of the following sets:
• B = {f ocaccia, baguette},
• C = {stilton, camembert, ricotta},
• M = {turkey, ham, chickpea, tof u}
However, there is a constraint: if baguette is chosen, then stilton and turkey cannot be chosen.
How many valid sandwiches are possible?
Solution:
We use a combination of the product and sum rules: we use the sum rule to count two disjoint
subsets of sandwiches: those that have baguettes and those that don’t. In the former case,
there are 2 · 3 = 6 possibilities. In the latter case, there are 3 · 4 = 12 possibilities. The total
number is thus 6 + 12 = 18.
5. (10 points) A bowl contains 10 red balls and 10 blue balls. A person selects balls at random
without looking at them. How many balls must be selected to be sure of having at least three
blue balls? Justify your answer.
Solution:
The total number of drawn balls is r +b, where r is the number of red balls, and b is the number
of blue ones. Let x be the minimum number of balls such that we are guaranteed to have at
least three blue balls. This is given by
The maximum in the above expression is achieved when we plug in r = 10, b = 2, so that
x = 13.
7. (10 points) Find a “big O” notation expression for f (n) = 10n + 1/n + 5n log n − 37 + 2log n as
n → ∞ that is as simple as possible.
Solution: The entire expression is O(n log n).
P100 100 j 100−j . Your answer should be a number or an
8. (10 points) Compute j=0 j 37 · (−35)
arithmetic expression, but should not contain variables.
Solution:
We can use the binomial theorem to simplify the expression:
100
X 100
37j · (−35)100−j = (37 − 35)100 = 2100 . (4)
j
j=0
ICSI 210 PRACTICE Final Exam SOLUTIONS Page 3 of 3
9. (10 points) Suppose that two sets A and B are such that |A| = 8, |B| = 10, and |A ∩ B| = 4.
Compute |A ∪ B|.
Solution:
We use the inclusion-exclusion principle. We have