CS 170, Fall 1997 Second Midterm Professor Papadimitriou

Similar documents
CSI 4105 MIDTERM SOLUTION

University of Washington March 21, 2013 Department of Computer Science and Engineering CSEP 521, Winter Exam Solution, Monday, March 18, 2013

CS325: Analysis of Algorithms, Fall Final Exam

Math 110 (Fall 2018) Midterm II (Monday October 29, 12:10-1:00)

CMPSCI 311: Introduction to Algorithms Second Midterm Exam

NAME: Be clear and concise. You may use the number of points assigned toeach problem as a rough

Midterm 1 for CS 170

Week 7 Solution. The two implementations are 1. Approach 1. int fib(int n) { if (n <= 1) return n; return fib(n 1) + fib(n 2); } 2.

CSE 421 Introduction to Algorithms Final Exam Winter 2005

University of Toronto Department of Electrical and Computer Engineering. Final Examination. ECE 345 Algorithms and Data Structures Fall 2016

CSC 8301 Design & Analysis of Algorithms: Lower Bounds

Algebra 1. Standard 1: Operations With Real Numbers Students simplify and compare expressions. They use rational exponents and simplify square roots.

Math 235: Linear Algebra

NATIONAL UNIVERSITY OF SINGAPORE CS3230 DESIGN AND ANALYSIS OF ALGORITHMS SEMESTER II: Time Allowed 2 Hours

Review. Midterm Exam. Midterm Review. May 6th, 2015 AMS-UCSC. Spring Session 1 (Midterm Review) AMS-5 May 6th, / 24

NP and Computational Intractability

Reteach Simplifying Algebraic Expressions

Algorithm Design and Analysis

CMSC Discrete Mathematics SOLUTIONS TO FIRST MIDTERM EXAM October 18, 2005 posted Nov 2, 2005

CS 320, Fall Dr. Geri Georg, Instructor 320 NP 1

EECS 126 Probability and Random Processes University of California, Berkeley: Fall 2014 Kannan Ramchandran September 23, 2014.

Midterm Exam 2 Solutions

VIII. NP-completeness

Archdiocese of Washington Catholic Schools Academic Standards Mathematics

University of New Mexico Department of Computer Science. Final Examination. CS 561 Data Structures and Algorithms Fall, 2013

Simplify each numerical expression. Show all work! Only use a calculator to check. 1) x ) 25 ( x 2 3) 3) 4)

Math 120 online. Practice Midterm Exam #2 Prof. Kinoshita. Fall (Actual midterm will have 100 pts)

CS 170 Algorithms Spring 2009 David Wagner Final

CSCE 750 Final Exam Answer Key Wednesday December 7, 2005

CS173 Lecture B, September 10, 2015

CS154 Final Examination

Midterm Exam 1 (Solutions)

COMPSCI 611 Advanced Algorithms Second Midterm Exam Fall 2017

Algebra II Summer Packet. Summer Name:

CS246 Final Exam, Winter 2011

FINAL EXAM PRACTICE PROBLEMS CMSC 451 (Spring 2016)

More on NP and Reductions

Math 1132 Practice Exam 1 Spring 2016

Math 1: Calculus with Algebra Midterm 2 Thursday, October 29. Circle your section number: 1 Freund 2 DeFord

Concept Category 4. Quadratic Equations

NAME: Be clear and concise. You may use the number of points assigned toeach problem as a rough

Math Lecture 3 Notes

Section 2.5 Formulas and Additional Applications from Geometry Section 2.6 Solving Linear Inequalities Section 7.

MATH 1553, C.J. JANKOWSKI MIDTERM 1

Parenthesis and other grouping symbols. Exponential expressions. Multiplication & Division Addition & Subtraction.

Exam 2 Solutions. x 1 x. x 4 The generating function for the problem is the fourth power of this, (1 x). 4

Correlation: California State Curriculum Standards of Mathematics for Grade 6 SUCCESS IN MATH: BASIC ALGEBRA

SOLUTIONS. Math 130 Midterm Spring True-False: Circle T if the statement is always true. Otherwise circle F.

Math Fall Final Exam. Friday, 14 December Show all work for full credit. The problems are worth 6 points each.

Exam in Discrete Mathematics

Recap from Last Time

CS1800 Discrete Structures Spring 2018 February CS1800 Discrete Structures Midterm Version A

NP-Completeness. f(n) \ n n sec sec sec. n sec 24.3 sec 5.2 mins. 2 n sec 17.9 mins 35.

Quiz 1 Solutions. Problem 2. Asymptotics & Recurrences [20 points] (3 parts)


MIDTERM Fundamental Algorithms, Spring 2008, Professor Yap March 10, 2008

Problem set 1. (c) Is the Ford-Fulkerson algorithm guaranteed to produce an acyclic maximum flow?

CS 170 Algorithms Fall 2014 David Wagner MT2

A Add, subtract, multiply, and simplify polynomials and rational expressions.


Midterm Exam 1 Solution

Essentials of Mathematics Lesson Objectives

NP and Computational Intractability

NP-Completeness Part II

Math 106: Calculus I, Spring 2018: Midterm Exam II Monday, April Give your name, TA and section number:

Summer Review. For Students Entering. Algebra 2 & Analysis

CSCI3390-Second Test with Solutions

Big Ideas: determine an approximate value of a radical expression using a variety of methods. REVIEW Radicals

California: Algebra 1

COMPSCI 611 Advanced Algorithms Second Midterm Exam Fall 2017

COMPUTER SCIENCE TRIPOS

CS154 Final Examination

Linear Algebra MATH20F Midterm 1

This is a closed book exam. No notes or calculators are permitted. We will drop your lowest scoring question for you.

Econ 172A, Fall 2012: Final Examination Solutions (I) 1. The entries in the table below describe the costs associated with an assignment

COP 4531 Complexity & Analysis of Data Structures & Algorithms

Computational Intractability 2010/4/15. Lecture 2

Equations and inequalities

NP Completeness. CS 374: Algorithms & Models of Computation, Spring Lecture 23. November 19, 2015

Midterm 1. Name: TA: U.C. Berkeley CS70 : Algorithms Midterm 1 Lecturers: Anant Sahai & Christos Papadimitriou October 15, 2008

Developed in Consultation with Virginia Educators

Computer Science Foundation Exam

Review Questions, Final Exam

2-7 Solving Absolute-Value Inequalities

Complex Numbers. Essential Question What are the subsets of the set of complex numbers? Integers. Whole Numbers. Natural Numbers

A. Incorrect! This inequality is a disjunction and has a solution set shaded outside the boundary points.

Online Courses for High School Students

Design and Analysis of Algorithms May 12, 2011 Massachusetts Institute of Technology. Practice Final Exam. Problem Title Points Parts Grade Initials

MIDTERM REVIEW. Write an algebraic expression to represent the following verbal expressions. 1) Double the difference of a number and 7.

Linear Algebra Exam 1 Spring 2007

Geometry Summer Assignment

NP-Completeness Part II

Algorithm Design and Analysis

6.045 Final Exam Solutions

NP-Completeness. Until now we have been designing algorithms for specific problems

Bessel s and legendre s equations

SAT, NP, NP-Completeness

University of Connecticut Department of Mathematics

Mid-term Exam Answers and Final Exam Study Guide CIS 675 Summer 2010

P versus NP. Math 40210, Spring September 16, Math (Spring 2012) P versus NP September 16, / 9

Transcription:

CS 170, Fall 1997 Second Midterm Professor Papadimitriou Problem #1 (10 Points) Remember the change-maker problem: We are given k integers d 1,..., d k > 0 (the coin denominations) and an integer n. We want to write n as the sum of denominations, with repetitions, with as few coins as possible. For example, for denominations 1, 5, 10, and 25, and n = 83, then the optimum solution is 25 + 25 + 25 + 5 + 1 + 1 + 1, with cost 7. Give a dynamic programming algorithm for the change-maker problem. Suppose that c(i) is the minimum number of coins adding up to i >= 0. A. Dynamic programming recurrence: Basis (value at zero): B. Justification of correctness: C. Running time of the corresponding algorithm, as a function of n and k (you don't have to describe the algorithm). Justification of the running time. D. Is this a polynomial-time algorithm? Why or why not? CS 170, Fall 1997 Second Midterm Professor Papadimitriou 1

Problem #2 (10 Points) (a) Write the change-maker problem (see the previous problem) as an integer linear programming problem: choose your variables: minimize this linear function: subject to these constraints: plus, all variables should be integers. (b) Can we solve this problem by solving it as a linear programming problem with the certainty that the answer will come out integer, as in the bipartite matching problem? Either justify why this is the case, or give a counterexample in which the optimum of the linear program is not integer. Problem #1 2

Problem #3 (10 points) STINGY SAT is the following problem: Given a set of clauses, and an integer K, is there a truth assignment that satisfies all clauses and has at most K TRUEs in it? Prove that this problem is NP-complete. STINGY SAT is in NP: Reduction form Justification of the reduction. Problem #4 (10 points) Consider the instance of the max-flow problem shown below. A. What is the value of the maximum flow from S to T? Problem #3 3

B. Indicate a minimum cut between S and T by drawing a line through the diagram above. C. Suppose that you run the Ford-Fulkerson algorithm on this network. In the first iteration you find a path by depth-first search from S (breaking ties, as always, lexicographically), and augment along it. Show the resulting residual network (the network on which you will find an augmenting path next). Problem #5 (Total of 33 points) True or false? No explanation required, except for partial credit. Each question is worth 1.5 points, for a perfect score of 33. One point will be subtracted for wrong answers after the first two, so answer only if you are reasonably certain. The solution of T(n) = 2T(n/2) + n, T(1) = 0 is Theta(n log n). The solution of T(n) = 7T(n/2) + n3, T(1) = 0 is Theta(n3). The solution of T(n) = 4T(n/2) + n2, T(1) = 0 is Theta(n2). In Huffman coding, if all frequencies of symbols are distinct, then the most frequent symbol gets the shortest code. In Huffman coding, if all frequencies of symbols are distinct, then the second least frequent symbol gets the longest code. If all frequencies of symbols are distinct, the optimum Huffman code is unique. If the dynamic programming recurrence is C[i,j] = min i < k < j [C[i,k] + C[k,j] + k], i <= j = 1,..., n then the algorithm will take O(n2) time. If the dynamic programming recurrence is C[i,j] = min {2C[i - 1, j], 2C[i,j - 1], 4C[i - 1, j - 1]}, i <= j = 1,..., n then the algorithm will take O(n2) time. FFT stands for "fast Fourier transform." Problem #4 4

If w is the nth root of unity, then w2 is the 2nth root of unity. If w is the nth root of unity, then w2 is the (n/2)nd root of unity. To multiply two polynomials of degrees 16 and 13, respectively, we should use the FFT with 32nd roots of unity. If all capcities in a max-flow problem are integers, then there is an integer optimum. If all capcities in a max-flow problem are integers, then a flow with fractional values cannot be optimum. There is a known polynomial-time algorithm for linear programming. There is a known polynomial-time algorithm for integer linear programming. The simplex algorithm solves linear programming in polynomial time. If P = NP then all NP-complete problems are solvable in polynomial time. If one NP-complete problem is solvable in polynomial time then P = NP. There are decision problems that are not in NP. one point extra credit Write the complete expansion of the polynomial (x - a) * (x - b) * (x - c)... (x - z) If a directed graph has a Hamilton cycle then it is strongly connected. If a directly graph is strongly connected then it has a Hamilton cycle. Posted by HKN (Electrical Engineering and Computer Science Honor Society) University of California at Berkeley If you have any questions about these online exams please contact examfile@hkn.eecs.berkeley.edu. Problem #5 5