CSCI 2200 Foundations of Computer Science (FoCS) Homework 6 (document version 1.0) Overview This homework is due by 11:59:59 PM on Friday, March 23, 2018. This homework is to be completed individually. Do not share your work with anyone else. You must type your solutions for this homework assignment, then generate a PDF. Handwritten assignments will not be graded. You are strongly encouraged to use LaTeX, in particular for mathematical symbols. references on the course website. See Upload your PDF to Submitty; note there is a 1MB limit for file size. Please be concise and to the point in your answers. Even if your solution is correct, if it is not well-written, you may lose points. You have five late days to use throughout the semester. You may use at most three late days on this assignment. Please start your homework early and ask questions at office hours and your recitation section. Also ask (and answer) questions on Piazza. You can use either the new textbook or the textbook from last semester (i.e., F17). Problems are listed below from the current textbook; if the problem was numbered differently in the F17 textbook, the F17 problem is listed in square brackets.
Warm-up Exercises (before Wednesday Recitation) 1. Problem 10.18(a) [or F17 Problem 10.14(a)]: (a) Compute the LCM for the pairs: (2, 3); (3, 5); (6, 8). 2. Problem 11.6 [or F17 Problem 11.5]: Is there a friend network with 7 friends, each of who know 3 friends? 3. Problem 11.17(a)-(b): Show the following facts of any graph with n vertices. (a) There are at least two vertices with the same degree. (b) It is always possible to partition the vertices into two sets so that for every vertex in one of the sets, at least half of its neighbors are in the other set. 4. Problem 11.21(a)-(c) [or F17 Problem 11.20(a)-(c)]: For a connected graph G, prove the following claims. (a) G has an Euler cycle if and only if every vertex has even degree. (b) G has an Euler path (not a cycle) if and only if all vertices but two have even degree. (c) One can transform G into a graph having an Euler cycle by adding at most one vertex and edges only from this new vertex to the other vertices. Similarly, one can get an Euler path. 5. Problem 11.33: A cut-vertex in a connected graph is a vertex whose removal results in the remaining graph being disconnected. Identify all the cut-vertices in the graph on the right. [See the textbook for the graph.] 6. Problem 12.38(a)-(d): Solve each problem for the graph on the right. [See the textbook for the graph.] (a) Clique: A set of pairwise adjacent vertices is a clique. Find a largest clique. (b) IndependentSet: A set of pairwise non-adjacent vertices is an independent set. Find a largest independent set. (c) VertexCover: A vertex cover is a set of vertices; every edge must have at least one endpoint in the vertex cover. Find a smallest vertex cover. (d) DominatingSet: Vertices form a dominating set if every other vertex has a neighbor in the dominating set. Find a smallest dominating set. If you find an efficient way to solve any of these problems on general graphs, instant fame awaits. 7. Problem 13.5: An exam has 4 t/f questions; 6 multiple choice questions with four choices each; and a long-answer question whose answer is an integer between 5 and 5 (inclusive). How many possible ways are there to answer the exam? 2
Recitation Exercises (before/during Wednesday Recitation) Note that there might not be time to cover all of these problems during recitation. 1. Problem 10.18(b) [or F17 Problem 10.14(b)]: (b) Compute gcd(12, 16), lcm(12, 16), gcd(12, 16) lcm(12, 16), 12 16. 2. Problem 11.13(a)-(b) [or F17 Problem 11.12(a)-(b)]: (a) What is the maximum number of edges a graph can have and not be connected? Prove it. (b) What is the minimum number of edges a graph can have and be connected? Prove it. 3. Problem 12.8: In a regular bipartite graph, every vertex has the same degree. Prove: (a) The number of left-vertices equals the number of right-vertices. (b) There is a matching that covers the left-vertices. [Hint: Hall s theorem.] 4. Problem 12.49 [or F17 Problem 12.50]: An independent set is maximal if you cannot increase its size by adding any other vertex. Prove that any maximal independent set is a dominating set. When is the complement of a maximal independent set also a dominating set? 5. Problem 13.11(a)-(c) [this problem is not in the F17 textbook]: 50 runners compete. How many possible outcomes are there when: (a) We care about the order of all finishers. (b) We are only interested in who gets gold, silver, and bronze. (c) We only care about who are in the top-10 finishers, who will qualify for the final. 6. Problem 13.22(a) [or F17 Problem 13.15(a)]: A US Social Security number has 9 digits. The first digit may be zero. (a) How many SS numbers are there? How many are even? How many have only even digits? 3
Homework Problems (to be handed in and graded) 1. [14 POINTS] Problem 9.47 [this problem is not in the F17 textbook]: A postage dispenser has 4 and 7 stamps. A customer will input n, the desired postage, and the machine should: (a) Determine if postage n can be dispensed (yes or no), and (b) If yes, give a way to dispense the postage: numbers n 4 and n 7 for which n = 4n 4 + 7n 7. Give an algorithm to solve (a) and (b) in O(1) compute-time. Assume basic operations take O(1) time on any inputs (+,,,,, ). (Note, dispensing the postage will take linear time.) 2. [16 POINTS] Problem 10.18(c) [or F17 Problem 10.14(c)]: (c) Prove that lcm(m, n) gcd(m, n) = mn. (i) Let m = k gcd(m, n) and n = k gcd(m, n). Prove lcm(m, n) kk gcd(m, n). (ii) Prove mn lcm(m, n) gcd(m, n), hence lcm(m, n) gcd(m, n) mn. [Hint: Bezout.] (iii) Use (i) and (ii) to prove lcm(m, n) = kk gcd(m, n) and lcm(m, n) gcd(m, n) = mn. 3. [14 POINTS] Problem 11.17(c)-(d): Show the following facts of any graph with n vertices. (c) If every vertex has degree at least δ 2, there is a cycle of length at least δ + 1. (d) If every vertex has degree at least n/2, the graph is connected. 4. [10 POINTS] Problem 11.37: Similar to a cut-vertex, an edge e is a cut-edge in G if the removal of e disconnects G. Prove that e is a cut-edge if and only if it is not on any cycle of G. 5. [10 POINTS] Problem 12.13 [or F17 Problem 12.11]: The n jobs J 1,..., J n must be performed on m servers S 1,..., S m. Each server S i has the capacity to do l i 0 jobs. Each job can be done on some subset of the server. Give necessary and sufficient conditions for being able to do all the jobs. 6. [10 POINTS] Problem 12.54 [or F17 Problem 12.50]: For a graph G with n vertices, α(g) is the maximum size of an independent set and χ(g) is the minimum number of colors needed to color G. Prove χ(g) n/α(g). 7. [10 POINTS] Problem 13.21 [or F17 Problem 13.14]: US dollar bills have 8-digit serial numbers, e.g., 62655681. A bill is defective if a digit repeats. What fraction of bills are defective? [Hint: Count the non-defective bills.] 8. [16 POINTS] Problem 13.22(b)-(c) [or F17 Problem 13.15(b)-(c)]: A US Social Security number has 9 digits. The first digit may be zero. (b) How many are palindromes (e.g., 342151243)? (c) How many have no 8? How many have at least one 8? How many have exactly one 8? 4
Submission Instructions To submit your assignment your code, as noted on page 1, please generate a PDF of typewritten work, then submit the PDF via Submitty, the homework submission server. The specific URL is on the course website. Be sure you submit only your PDF file. And only submit solutions to problems posed in the Homework Problems section above. 5