Study Guide for CS/Math 111 Final

Asymptotic Notation
  1. big-O, big-Ω, big-Θ notations
  2. Polynomial, exponential, and logarithmic functions
  3. Estimating the growth of of functions using asymptotic notation: express the magnitude of function f(n) using the Θ notation, where
  4. f(n) = 4n3 +2n + 1
  5. f(n) = n3logn +5n2log3n + 13
  6. Estimating the running time of algorithms (given a piece of pseudo-code, determine its asymptotic running time).

Relations
  1. Definition of relations
  2. Properties of relations: reflexive, symmetric, and transitive relations
  3. Given a relation ... determine whether this relation is transitive, reflexive, symmetric, anti-symmetric, equivalence relation, partial order.
  4. Equivalence relations, and equivalence classes.
  5. Let X be the set of all pairs (x,y) of integers, where 0 ≤ x ≤ 2 and 0 ≤ y ≤ 3. Define relation R such that (x,y) R (u,v) if and only if x+y = u+v (mod 3). Give the matrix of R and show that R is an equivalence relation. List equivalence classes of R.
  6. Let Z be the set of all integers, and let R be a relation on Z such that xRy iff |x-y| ≤ 3. Is R an equivalence relation? Justify your answer.
  7. Partial orders.
  8. Let X be the set of all pairs (x,y) of integers, where 0 ≤ x ≤ 2 and 0 ≤ y ≤ 3. Let R be the relation on X such that (x,y)R(u,v) iff x ≤ u and y ≥ v. Give the matrix of R. Is R a partial order? Justify your answer.
  9. Consider an arbitrary directed acyclic graph G. Define a relation R on its vertices as follows: uRv iff there is a directed path from u to v. Prove that R is a partial order.

Induction
  1. Prove by induction that 1+2+...+n = n(n+1)/2.
  2. Prove by induction that 1+r + r2 + ...+rn = (rn+1-1)/(r-1).
  3. Let h0 = h1 = 1 and hn = 2hn-1 + hn-2 for n ≥ 2. Prove that hn ≤ 2.5n.
  4. Prove (by induction) that a binary tree of height h has at most 2h leaves.
  5. Prove that a tree with n nodes has exactly n-1 edges.
  6. Use induction to prove Euler's formula for planar graphs.

Number Theory
  1. The basics: prime numbers, factorization, relatively prime numbers, greatest common divisor, least common multiple.
  2. Famous problems in number theory (state): Fermat's Last Theorem, Goldbach Conjecture, Twin Primes Conjecture, Primality Testing, Factorization, The Prime Number Theorem.
  3. Fast modular exponentiation: state the algorithm, use the algorithm to compute 317 mod 5,...
  4. Euclid's algorithm: state the algorithm, use the algorithm to compute gcd(18,159),...
  5. gcd(a,b) as a linear combination of a,b. Using Euclid's algorithm to compute α and β satisfying α a + β b = gcd(a,b).
  6. Modular arithmetic: computing sum, difference, multiplication, or powers modulo a number. Example: compute 7547549 rem 8.
  7. Inverses modulo a prime. Using linear combinations to compute inverses.
  8. Linear congruences and inverses: find x such that 7x = 5 (mod 19)
  9. Fermat's Little Theorem: state the theorem, show an example (choose a prime at least 10, and some other integer x at most p-1, and compute xp-1 mod p.).
  10. How we can use Fermat's Little Theorem to compute inverses. Use it to compute 2-1 (mod 11)
  11. Use Fermat's Little Theorem to compute 31247 rem 13
  12. The RSA
  13. Explain the principles of public-key cryptosystems
  14. Explain the RSA (initialization, encryption, decryption)
  15. Suppose that Bob chooses p = 5, q = 11. Show some correct values of e (public exponent) and d (secret exponent).
  16. Bob uses P = (143,19) as his public key and S = 21 as his secret key. Is Bob's system correct?
  17. Suppose Bob chooses p =7, q = 13, e = 11. Determine d. If Alice wants to send M = 10 to Bob, what is the ciphertext?

Linear Recurrence Relations
  1. Give the recurrence relation for Fibonacci numbers.
  2. Setting up recurrence relations.
  3. Consider the following problem, similar to the tiling problem we covered in class. We want to tile a 3 by n grid with 1 by 2 tiles. Let gn be the number of such tilings. Derive a recurrence relation for gn.
  4. One female rabbit produces 3 female rabbits per week, starting the 2nd week after its born. You receive one newly-born female rabbit for your birthday. How many female rabbits you will have after n weeks? (These are genetically modified female rabbits that do not need male rabbits for reproduction.)
  5. Solving linear homogeneous recurrences equations (degree 1, 2, perhaps 3):
  6. Solve the following recurrence: fn = 5fn-1 - 6fn-2, with initial conditions f0 = 1, f1 = 2. Show your work.
  7. Determine the general solution of the recurrence hn = 5hn-1 + 15hn-2 - 9 h n-3
  8. Solving linear non-homogeneous recurrences equations (degree 1 and 2)
  9. Solve the recurrence Dn = 3Dn-1 +2n, D0 = 0.
  10. Find a particular solution of the recurrence fn = 5fn-1 - 6fn-2 + n+5.
  11. Find a particular solution of the recurrence gn = 5gn-1 - 6gn-2 + 2n.

Divide-and-Conquer Recurrences
  1. State the Master Theorem
  2. Give an (asymptotic) solution to the following recurrence: f(n) = 3f(n/2) + 3n
  3. Give an (asymptotic) solution to the following recurrence: f(n) = 8f(n/2) + 5*n4
  4. Given the pseudo-code below, what is the (asymptotic) number of lines printed on input n? ...

Inclusion-Exclusion
  1. Give a complete statement of the inclusion-exclusion principle.
  2. Suppose that we have sets A, B, C such that |A|= 22, |B| = 36, |C| = 26, |A ∩ B| = 2|A ∩ B ∩ C|, |A ∩ C| = 3|A ∩ B ∩ C|, |B ∩ C| = 4|A ∩ B ∩ C|, |A ∪ B ∪ C| = 13|A ∩ B ∩ C|. Determine the number of elements in the of these three sets.
  3. We have a group of 53 people, including 22 US citizens, 15 Mexican citizens, and 27 Canadian citizens. Among them, 4 people have a dual US-Mexican citizenship, 5 have US-Canadian citizenship, and 6 have Canadian-Mexican citizenship. How many people have a triple citizenship?
  4. Compute φ(440) (φ(n) is the Euler totient function).
  5. Give the number of solutions of x+y+z = 30, for 4 ≤ x ≤ 14, 3 ≤ y ≤ 17, 10 ≤ z ≤ 25.

Graphs
  1. Prove that in an undirected graph G the sum of all vertex degrees is equal to two times the number of edges.
  2. Draw an undirected graph with 6 vertices X,Y,Z,T,U,Q, whose degrees are deg(X) = 3, deg(Y) = 5, deg(Z) = 4, deg(U) = 3, deg(T) = 2, deg(Q) = 1.
  3. State the sufficient and necessary condition for an undirected graph to have an Euler cycle. Prove that if an undirected graph has an Euler cycle then all vertex degrees are even.
  4. Can you generalize the characterization of Eulerian graphs to directed graphs?
  5. State Dirac's theorem.
  6. For graphs shown below ...., tell whether they have (a) an Euler tour, (b) a Hamiltonian cycle. Justify your answer.
  7. For graphs shown below, determine the minimum number of colors needed to color them. Justify your answer.
  8. Define what is a planar graph.
  9. State Kuratowski's theorem (and define the terms used in this theorem).
  10. Give Euler's formula for planar graphs (and define the terms involved in it.)
  11. Using Euler's formula, prove that in a planar graph, m ≤ 3n-6 (where m,n denote the numbers of edges and vertices.)
  12. Use Euler's inequality (m ≤ 3n-6) to prove that each planar graph has a vertex of degree at most 5.
    Stronger version: Each sufficiently large planar graph must have at least a certain number of vertices of degree at most 5. What is this number? Justify your answer.
  13. Given the graphs below (...), determine whether they are planar or not. If a graph is planar, show a planar embedding. If a graph is not planar, prove it. (You can use Euler's inequality, Kuratowski's theorem, or a direct argument.)
  14. How many colors are needed to color planar graphs? Give a proof that each planar graph can be colored with at most 6 colors. (Hint: induction. Use the fact that each planar graph has a vertex of degree no more than 5.)
  15. State Hall's Theorem. For the bipartite graph below..., tell whether it has a perfect matching. Justify your answer.

Trees
  1. Prove, by induction, that a tree with n nodes has exactly n-1 edges.
  2. Binary trees
  3. Prove (by induction) that a binary tree of height h has at most 2h leaves.
  4. Prove (by induction) that a binary tree of height h has at most 2h+1-1 nodes.
  5. Draw a decision (comparison) tree for sorting 4 items.
  6. Similarly as for sorting, we can consider decision trees for other problems that can be solved using comparisons. Draw a decision tree for selecting the second smallest element out of five.