






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!







Fill in your name, netid, and discussion section time below. Also write your name or netid on the last page (which sometimes gets pulled off).
7
, and the like.
(a) (5 points) Check all boxes which correctly characterize this relation leaving the other boxes blank. (If you change your answer, make it very clear when you’ve meant to uncheck a box.)
Reflexive: Irreflexive:
Symmetric: Antisymmetric:
Transitive:
(b) (4 points) Suppose that T is the subset of Z^2 defined by the following recursive rules:
rule 1) (2, 0) is in T rule 2) If (x, y) is in T , then (x, y + 1) is in T. rule 3) If (x, y) and (a, b) are in T , then (x + a, y + b) is in T.
Give a closed-form (i.e. non-recursive) definition of T using set-builder notation. Show your work or briefly explain why your closed form is correct.
(a) (4 points) Suppose that R is a relation on a set A. Using precise mathematical language, define what it means for R to be antisymmetric.
(b) (4 points) Suppose that the equivalence relation ∼ on Z is defined such that x ∼ y if and only if 5|(2x + 3y). List four members of the equivalence class [7].
(c) (4 points) Suppose that A = { 4 } and B = { 8 , 9 }. List the elements of P(P(A)) × B.
(a) (4 points) When playing the game “Faculty Wars,” your battlegroup is a set of 10 characters. Each character can be either a Dean, a Department Head, a Professor, a Lecturer, or a TA. You can choose any number (including zero) of each character type. In how many different ways can you form your battlegroup?
(b) (6 points) A domino consists of two squares (“ends”). Each end may be blank or may contain between one and n spots. A domino may have the same number of spots on both ends, or different numbers of spots on the two ends. A double-n domino set contains exactly one of each possible dot combination, where the order of the two ends doesn’t matter. For example, a double-two domino set would contain: (0, 0), (1, 0), (2, 0), (1, 1), (1, 2), (2, 2). How many dominoes are there in a double-n set? Show your work or explain why your formula is correct.
(a) (6 points) Let’s define the relation T on R^2 as follows
(a, b) T (c, d) if and only if c − a ≥ 3 and d − b ≥ 3.
Prove that T is transitive.
(b) (6 points) Prove that 4n^3 + n is O(n^3 ). Prove this directly from the definition of what it means for a function f to be O(g), where g is another function. Give details of the algebra and make sure that your algebraic steps are in logical order.
Suppose that A, B, and C are sets and suppose we have two functions f : A → B and g : B → C. Also recall the definition of g ◦ f : it’s the function from A to C defined by (g ◦ f )(x) = g(f (x)).
(a) (6 points) Prove the following claim: if f is one-to-one and g is one-to-one, then g ◦ f is one-to-one.
(b) (5 points) Suppose we know that g ◦ f is onto. Professor Flitwick claims that f must be onto. Show that Professor Flitwick is wrong using a concrete counter-example in which A, B, and C are all finite sets.
The procedure crunch takes an array of integers a 1 , a 2 ,... , an (where n ≥ 1) and returns an integer. Here is its pseudo-code. Assume that dividing the array in two (line 6) requires only constant time. 1 crunch(a 1 ,... , an : array of integers) 2 if (n = 1 and a 1 ≥ 0) return 1 3 else if (n = 1) return 0 4 else 5 m = ⌊n 2 ⌋ 6 output = crunch(a 1 ,... , am) + crunch(am+1,... , an) 7 return output
(a) (2 points) Give a succinct English description of what crunch computes.
(b) (3 points) Suppose that T (n) is the running time of crunch on an input array of length n. Write down a recurrence for T (n), including a base case. For simplicity, you may assume that n is a power of 2.
(c) (3 points) What is the big-Θ running time of crunch? Justify your answer, e.g. by unrolling your recurrence or by drawing a (well-labelled) recursion tree.