Efficient Algorithms and Intractable Problems Spring 2016 Alessandro Chiesa and Umesh Vazirani Midterm 2

Similar documents
CS 170 Algorithms Fall 2014 David Wagner MT2

MTH 132 Solutions to Exam 2 Nov. 23rd 2015

Math 51 Midterm 1 July 6, 2016

CS 170 Algorithms Spring 2009 David Wagner Final

University of California Berkeley CS170: Efficient Algorithms and Intractable Problems November 19, 2001 Professor Luca Trevisan. Midterm 2 Solutions

Designing Information Devices and Systems I Spring 2019 Midterm 2. Exam Location: Cory 521 (DSP)

MTH 132 Solutions to Exam 2 Apr. 13th 2015

University of Maryland Department of Physics. Spring 2009 Final Exam 20. May (175 points) Post grades on web? (Initial, please) Yes No

Do not turn this page until you have received the signal to start. Please fill out the identification section above. Good Luck!

Without fully opening the exam, check that you have pages 1 through 10.

Designing Information Devices and Systems I Spring 2018 Midterm 1. Exam Location: 155 Dwinelle Last Name: Cheng - Lazich

Midterm 2. Your Exam Room: Name of Person Sitting on Your Left: Name of Person Sitting on Your Right: Name of Person Sitting in Front of You:

Physics 7A, Section 1 (Prof. Speliotopoulos) First Midterm, Fall 2008 Berkeley, CA

Fall 2016 Test 1 with Solutions

Physics 206 Exam I. Spring 2019 (all UP sections) February 18 th, 2019

Physics Exam I

Design and Analysis of Algorithms April 16, 2015 Massachusetts Institute of Technology Profs. Erik Demaine, Srini Devadas, and Nancy Lynch Quiz 2

Spring /11/2009

Designing Information Devices and Systems I Fall 2017 Midterm 1. Exam Location: 155 Dwinelle

Midterm 1. Your Exam Room: Name of Person Sitting on Your Left: Name of Person Sitting on Your Right: Name of Person Sitting in Front of You:

Physics Grading Sheet.

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

Designing Information Devices and Systems I Fall 2017 Midterm 2. Exam Location: 150 Wheeler, Last Name: Nguyen - ZZZ

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

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

Physics 218 Exam I. Spring 2017 (all sections) February 13 th, 2017

Math 53 Final Exam, Prof. Srivastava May 11, 2018, 11:40pm 2:30pm, 155 Dwinelle Hall.

HKUST. MATH1013 Calculus IB. Directions:

STUDENT NAME: STUDENT SIGNATURE: STUDENT ID NUMBER: SECTION NUMBER RECITATION INSTRUCTOR:

Without fully opening the exam, check that you have pages 1 through 11.

Practice Second Midterm Exam III

Physics Exam II

Without fully opening the exam, check that you have pages 1 through 11.

Physics Exam I

Midterm 2. DO NOT turn this page until you are instructed to do so

Physics Grading Sheet.

GOOD LUCK! 2. a b c d e 12. a b c d e. 3. a b c d e 13. a b c d e. 4. a b c d e 14. a b c d e. 5. a b c d e 15. a b c d e. 6. a b c d e 16.


Math 115 Second Midterm November 12, 2018

COMPSCI 611 Advanced Algorithms Second Midterm Exam Fall 2017

Designing Information Devices and Systems I Summer 2017 D. Aranki, F. Maksimovic, V. Swamy Midterm 2. Exam Location: 100 Genetics & Plant Bio

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Department of Electrical Engineering and Computer Science ALGORITHMS FOR INFERENCE Fall 2014

Final Exam (Version B) December 16, 2014 Name: NetID: Section: 1 2 3

Name. University of Maryland Department of Physics Physics 374 Dr. E. F. Redish Fall 2004 Exam 2 3. December, 2004

MATH 1553, FALL 2018 SAMPLE MIDTERM 2: 3.5 THROUGH 4.4

Computer Science 385 Analysis of Algorithms Siena College Spring Topic Notes: Limitations of Algorithms

Calculus is Cool. Math 160 Calculus for Physical Scientists I Exam 1 September 18, 2014, 5:00-6:50 pm. NAME: Instructor: Time your class meets:

Coding for Digital Communication and Beyond Fall 2013 Anant Sahai MT 1

Without fully opening the exam, check that you have pages 1 through 11.

LHS Algebra Pre-Test

Midterm II. Introduction to Artificial Intelligence. CS 188 Spring ˆ You have approximately 1 hour and 50 minutes.

Algorithms Exam TIN093 /DIT602

MTH 132 Exam 2 November 21st, Without fully opening the exam, check that you have pages 1 through 11.

Designing Information Devices and Systems II Spring 2016 Anant Sahai and Michel Maharbiz Midterm 1. Exam location: 1 Pimentel (Odd SID + 61C)

ALGEBRA 1 FINAL EXAM 2006

You have 3 hours to complete the exam. Some questions are harder than others, so don t spend too long on any one question.

'XNH8QLYHUVLW\ (GPXQG73UDWW-U6FKRRORI(QJLQHHULQJ. EGR 224 Spring Test II. Michael R. Gustafson II

CO759: Algorithmic Game Theory Spring 2015

Math 54 First Midterm Exam, Prof. Srivastava September 23, 2016, 4:10pm 5:00pm, 155 Dwinelle Hall.

Math 164 (Lec 1): Optimization Instructor: Alpár R. Mészáros

Math 160 Calculus for Physical Scientists I Exam 1 February 11, 2016, 5:00-6:50 pm

Math 115 Second Midterm November 12, 2018

Test 3 Version A. On my honor, I have neither given nor received inappropriate or unauthorized information at any time before or during this test.

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

Math 1426 Midterm 2 Version A Spring 2011

Math 116 Second Midterm March 20, 2017

Math 16 - Practice Final

December 2014 MATH 340 Name Page 2 of 10 pages

STUDENT NAME: STUDENT SIGNATURE: STUDENT ID NUMBER: SECTION NUMBER RECITATION INSTRUCTOR:

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

Final Exam Version A December 16, 2014 Name: NetID: Section: # Total Score

Designing Information Devices and Systems II Spring 2016 Anant Sahai and Michel Maharbiz Midterm 2

'XNH8QLYHUVLW\ (GPXQG73UDWW-U6FKRRORI(QJLQHHULQJ. EGR 224 Spring Test II. Michael R. Gustafson II

MTH 133 Final Exam Dec 8, 2014

MTH 132 Solutions to Exam 2 November 21st, Without fully opening the exam, check that you have pages 1 through 11.

MATH 1553, JANKOWSKI MIDTERM 2, SPRING 2018, LECTURE A

MATH 120 THIRD UNIT TEST

Test 3 Version A. On my honor, I have neither given nor received inappropriate or unauthorized information at any time before or during this test.

University of Ottawa

EE C128 / ME C134 Midterm Fall 2014

Machine Learning, Fall 2009: Midterm

DEPARTMENT OF EECS MASSACHUSETTS INSTITUTE OF TECHNOLOGY. 6.02: Digital Communication Systems, Fall Quiz I. October 11, 2012

GOOD LUCK! 2. a b c d e 12. a b c d e. 3. a b c d e 13. a b c d e. 4. a b c d e 14. a b c d e. 5. a b c d e 15. a b c d e. 6. a b c d e 16.


MLC Practice Final Exam. Recitation Instructor: Page Points Score Total: 200.

Introduction to Algorithms March 10, 2010 Massachusetts Institute of Technology Spring 2010 Professors Piotr Indyk and David Karger Quiz 1

Page Points Score Total: 100

Midterm 1 for CS 170

Physics 218 Exam II. Spring 2018 (all UP sections) March 19 th, 2018

YEAR 10 MATHEMATICS Examination - Semester 2, 2015 WRITTEN QUESTION AND ANSWER BOOKLET

CS 361 Sample Midterm 2

GEORGIA INSTITUTE OF TECHNOLOGY SCHOOL of ELECTRICAL & COMPUTER ENGINEERING FINAL EXAM. COURSE: ECE 3084A (Prof. Michaels)

Name: Student ID: Instructions:

Multiple Choice Answers. MA 114 Calculus II Spring 2013 Final Exam 1 May Question

Name. University of Maryland Department of Physics

Designing Information Devices and Systems I Fall 2015 Anant Sahai, Ali Niknejad Midterm 1. Exam location: 60 Evans, last digit SID= 6

MA 262, Spring 2018, Midterm 1 Version 01 (Green)

MATH 1080 SECOND MIDTERM EXAM

MTH 234 Exam 1 February 20th, Without fully opening the exam, check that you have pages 1 through 11.

Without fully opening the exam, check that you have pages 1 through 11.

Transcription:

CS 170 Efficient Algorithms and Intractable Problems Spring 2016 Alessandro Chiesa and Umesh Vazirani Midterm 2 Name: SID: GSI and section time: Write down the names of the students around you as they appear on their SID. Name of student on your left: Name of student on your right: Name of student behind you: Name of student in front of you: Note: For each question part, 20% of the points will be given to any blank answer, or to any clearly crossedout answer. Note: If you finish in the last 15 minutes, please remain seated and not leave early, to not distract your fellow classmates. Instructions: You may consult one handwritten, two-sided sheet of notes. You may not consult other notes, textbooks, etc. Cell phones and other electronic devices are not permitted. There are 4 questions. The last question is on page 9. Answer all questions. On questions asking for an algorithm, make sure to respond in the format we request. Be precise and concise. Write in the space provided. Good luck! Do not turn this page until an instructor tells you to do so. CS 170, Spring 2016, Midterm 2 1

1. (40 pts.) Short Answer (a) (8 pts.) Maximum Spanning Tree (i) Find a maximum spanning tree of the graph below (indicate it by circling the weights of the edges included in the spanning tree). 1 A B C 3 1 4 1 2 D E F 7 G 3 3 4 5 H 5 I 6 J (ii) How many different maximum spanning trees does the above graph have? CS 170, Spring 2016, Midterm 2 2

(b) (10 pts.) Linear Programming Fundamentals min 2x 1 + 4x 2 x 1 + x 2 30 x 1 + 2x 2 0 x 1,x 2 5 (i) Draw the feasible region of this linear program, and find the optimum of this LP. (ii) Find the dual to the above linear program. CS 170, Spring 2016, Midterm 2 3

(c) (6 pts.) Cut Property e 1 1 3 e 2 e 3 e 5 e 6 2 e 4 4 Consider the cut shown above that separates vertices 1 and 2 from 3 and 4 in the given graph. Suppose we are given the weights of all 4 edges across this cut: w(e 1 ) = 1, w(e 2 ) = 2, w(e 3 ) = 2, w(e 4 ) = 3. w(e 5 ) and w(e 6 ) are unknown. Circle all the answers that apply for the following questions: (i) Which edge(s) must be part of every minimum spanning tree in G? e 1 e 2 e 3 e 4 (ii) Which edge(s) can be but aren t necessarily part of a minimum spanning tree in G? e 1 e 2 e 3 e 4 (iii) Which edge(s) must not be part of a minimum spanning tree in G? (d) (4 pts.) Min Cut e 1 e 2 e 3 e 4 2 a c s 1 5 t b 3 d In the graph G shown above, consider the cut that separates s and b from a,c,d,t. Assume that this is the min s t cut in G. In the max s t flow, what are the flow values through the following edges: (i) s a: (ii) a b: (iii) c b: (iv) b d: CS 170, Spring 2016, Midterm 2 4

(e) (5 pts.) Huffman Encoding Below is a Huffman encoding tree of 3 symbols, where leaf values 0.2, x and y indicate the frequencies of each symbol. Since they represent frequencies, 0.2 + x + y = 1. Give the minimum and maximum values that x can take so that this tree still minimizes the expected length of the encoding. 0.2 y x (f) (7 pts.) Zero-Sum Games Column: c 1 c 2 Row: r 1 1-1 r 2-1 1 In the zero-sum game shown above, Row seeks to maximize the value of the game, and Column seeks to minimize it. Assume that Row must announce her strategy (the probabilities r 1 and r 2 ) first, and Column determines his strategy (c 1 and c 2 ) afterwards. For example, if Row announced the strategy r 1 = 1, r 2 = 0, Column could respond with the strategy c 1 = 0.25, c 2 = 0.75, and the value of the game would be 0.5. (i) What strategy should Row choose? (ii) Assuming that Column responds optimally, what is the value of the game? CS 170, Spring 2016, Midterm 2 5

2. (20 pts.) Matching Terminals There are n positive terminals and n negative terminals, arranged along the x-axis. The location of the t-th terminal (moving from left to right) is x(t), and its sign is s(t) (+ or ). You must connect each positive terminal to a distinct negative terminal, using a total of n pieces of wire. You wish to choose the pairing of the terminals to minimize the total length of wire used. Design a greedy algorithm to solve this problem. Use an exchange argument to prove that your algorithm finds the optimal solution. What is the running time of your algorithm? The above picture shows a possible layout of terminals for n = 4. The location value x(t) for each terminal t is written underneath the terminal. CS 170, Spring 2016, Midterm 2 6

3. (20 pts.) Knapsack with Weighty and Voluminous Objects A thief walks into a house and notices n objects with values v 1,...,v n, weights w 1,...,w n, and volumes u 1,...,u n. The thief has brought with him a bag that has a volume capacity of U, and can hold a total weight of W. He wishes to choose a subset of items whose total volume is at most U and weight at most W, and whose total value is as large as possible, but he must decide quickly and make his getaway. Give an efficient dynamic programming algorithm to help him choose. Clearly specify the subproblems, recurrence, the order in which you would solve the subproblems, and the running time. CS 170, Spring 2016, Midterm 2 7

4. (20 pts.) Breadth requirements UC Berkeley s newly formed College of Computer Science has several categories of breadth requirements. Each class is offered by a single department, and may match multiple categories. Students must take at least one class from each category, and at most k classes from each department. If a class matches multiple categories, you must choose which category you re using it to fulfill: no class can be used to fulfill more than one category. Formally, there are m classes c 1...c m, T departments D 1...D T, and n categories of breadth requirements G 1...G n. For some class c i, let H(c i ) be its department and F(c i ) be the set of categories it can be used to fulfill. For example, you could have H(c 10 ) = D 3 and F(c 10 ) = {G 3,G 4,G 9 }. Given G 1...G n, D 1...D T, F, and H, and a subset of classes c 1...c p, you want to determine whether the p classes satisfy all the breadth requirements subject to the above constraints. Alternatively, for 2/3 credit, you can ignore the departmental constraints (so the input is just c 1...c p, G 1...G n, and F). (a) Formulate the above problem as a linear program. Make sure to clearly identify and define what your variables are. Continued on next page... CS 170, Spring 2016, Midterm 2 8

(b) Now formulate the above problem as a network flow problem. Show how to determine from the maxflow whether the requirements are satisfied, and (if all requirements are satisfied) a mapping of which class contributes to which requirement. Prove the correctness of your reduction. Main idea of reduction, together with sketch of max-flow network: Proof: CS 170, Spring 2016, Midterm 2 9

Extra page Use this page for scratch work, or for more space to continue your solution to a problem. If you want this page to be graded, please refer the graders here from the original problem page. CS 170, Spring 2016, Midterm 2 10

Extra page Use this page for scratch work, or for more space to continue your solution to a problem. If you want this page to be graded, please refer the graders here from the original problem page. CS 170, Spring 2016, Midterm 2 11

Extra page Use this page for scratch work, or for more space to continue your solution to a problem. If you want this page to be graded, please refer the graders here from the original problem page. CS 170, Spring 2016, Midterm 2 12