UNIVERSITY OF TORONTO Department of Computer Science April 2014 Final Exam CSC373H1S Robert Robere Duration - 3 hours No Aids Allowed.

Similar documents
The Nonsense Prerequisites [2.5]

Introduction to Algorithms May 14, 2003 Massachusetts Institute of Technology Professors Erik Demaine and Shafi Goldwasser.

Questions Total Points Score

UML CS Algorithms Qualifying Exam Fall, 2003 ALGORITHMS QUALIFYING EXAM

CMPSCI 311: Introduction to Algorithms Practice Final Exam

END-TERM EXAMINATION

Algorithms Exam TIN093/DIT600

CPSC 536N: Randomized Algorithms Term 2. Lecture 10

Department of Computer Applications. MCA 312: Design and Analysis of Algorithms. [Part I : Medium Answer Type Questions] UNIT I

CMSC Theory of Algorithms Second Midterm

CS161 - Final Exam Computer Science Department, Stanford University August 16, 2008

Faculty of Science FINAL EXAMINATION COMP-250 A Introduction to Computer Science School of Computer Science, McGill University

CS 373: Combinatorial Algorithms, Spring 1999

CS521 \ Notes for the Final Exam

EECS Sample Midterm Exam

Questions Total Points Score

Introduction to Algorithms April 21, 2004 Massachusetts Institute of Technology. Quiz 2 Solutions

CSC 505, Fall 2000: Week 12

Vertex Cover Approximations

Approximation Algorithms

CS 161 Fall 2015 Final Exam

Introduction to Graph Theory

Recitation 13. Minimum Spanning Trees Announcements. SegmentLab has been released, and is due Friday, November 17. It s worth 135 points.

Notes for Lecture 24

Introduction to Algorithms October 12, 2005 Massachusetts Institute of Technology Professors Erik D. Demaine and Charles E. Leiserson Quiz 1.

Computability Theory

Chapter 16. Greedy Algorithms

CSC 373: Algorithm Design and Analysis Lecture 3

15-451/651: Design & Analysis of Algorithms November 4, 2015 Lecture #18 last changed: November 22, 2015

University of Toronto Mississauga. Flip to the back cover and write down your name and student number.

CMPSCI611: The SUBSET-SUM Problem Lecture 18

OF VICTORIA EXAMINATIONS- DECEMBER 2010 CSC

6.006 Final Exam Name 2. Problem 1. True or False [30 points] (10 parts) For each of the following questions, circle either True, False or Unknown.

CS1800 Discrete Structures Fall 2016 Profs. Aslam, Gold, Ossowski, Pavlu, & Sprague December 16, CS1800 Discrete Structures Final

6 Randomized rounding of semidefinite programs

Lecture 2. 1 Introduction. 2 The Set Cover Problem. COMPSCI 632: Approximation Algorithms August 30, 2017

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

Reductions. Linear Time Reductions. Desiderata. Reduction. Desiderata. Classify problems according to their computational requirements.

Introduction to Algorithms November 17, 2011 Massachusetts Institute of Technology Fall 2011 Professors Erik Demaine and Srini Devadas Quiz 2

Final Exam Solutions

CSE 332 Spring 2013: Midterm Exam (closed book, closed notes, no calculators)

D.K.M.COLLEGE FOR WOMEN (AUTONOMOUS), VELLORE-1.

Solutions for the Exam 6 January 2014

Midterm solutions. n f 3 (n) = 3

UCSD CSE 21, Spring 2014 [Section B00] Mathematics for Algorithm and System Analysis

CSE 373: Data Structures and Algorithms

Quiz 2. Problem Parts Points Grade Grader. Total 120. Name: Recitation: Jayant 12 PM. Christina 10 AM. Jayant 1 PM. Jason 2 PM.

Ideally your algorithms for both parts should run in linear time. You will receive partial credit for a polynomial-time algorithm.

INDIAN INSTITUTE OF TECHNOLOGY KHARAGPUR Stamp / Signature of the Invigilator

CSE 332 Spring 2014: Midterm Exam (closed book, closed notes, no calculators)

CSci 231 Final Review

Sankalchand Patel College of Engineering - Visnagar Department of Computer Engineering and Information Technology. Assignment

Graph Algorithms (part 3 of CSC 282),

Cornell University Computer Science 211 Second Preliminary Examination 18 April 2006

CPSC 311: Analysis of Algorithms (Honors) Exam 1 October 11, 2002

Solving NP-hard Problems on Special Instances

Approximation Algorithms

Mathematics Masters Examination

CS261: Problem Set #2

UML CS Algorithms Qualifying Exam Spring, 2004 ALGORITHMS QUALIFYING EXAM

Chapter 9 Graph Algorithms

Approximation Algorithms

CS61B, Fall 2015 Final Examination (with corrections) P. N. Hilfinger

CSE 332 Winter 2018 Final Exam (closed book, closed notes, no calculators)

11/22/2016. Chapter 9 Graph Algorithms. Introduction. Definitions. Definitions. Definitions. Definitions

6.006 Introduction to Algorithms. Lecture 25: Complexity Prof. Erik Demaine

1 Non greedy algorithms (which we should have covered

CS1800 Discrete Structures Fall 2016 Profs. Aslam, Gold, Ossowski, Pavlu, & Sprague December 16, CS1800 Discrete Structures Final

CSC Linear Programming and Combinatorial Optimization Lecture 12: Semidefinite Programming(SDP) Relaxation

CS490 Quiz 1. This is the written part of Quiz 1. The quiz is closed book; in particular, no notes, calculators and cell phones are allowed.

U.C. Berkeley CS170 : Algorithms Midterm 1 Lecturers: Alessandro Chiesa and Umesh Vazirani February 13, Midterm 1

Algorithms Exam 1. Ansvarig: Devdatt Dubhashi Tel (Willard Rafnsson) Rum 6479 EDIT

Chapter 9 Graph Algorithms

1 Definition of Reduction

COT 6936: Topics in Algorithms! Giri Narasimhan. ECS 254A / EC 2443; Phone: x3748

Algorithms Exam TIN093/DIT600

Algorithm Design and Analysis

Final Exam May 8, 2018

PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science

Combinatorial Optimization

/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Approximation algorithms Date: 11/27/18

Graph Algorithms (part 3 of CSC 282),

Introduction to Algorithms April 16, 2008 Massachusetts Institute of Technology Spring 2008 Professors Srini Devadas and Erik Demaine Quiz 2

Chapter 9 Graph Algorithms

n 2 ( ) ( ) Ο f ( n) ( ) Ω B. n logn Ο

Lecture Summary CSC 263H. August 5, 2016

Lecture outline. Graph coloring Examples Applications Algorithms

CLASS: II YEAR / IV SEMESTER CSE CS 6402-DESIGN AND ANALYSIS OF ALGORITHM UNIT I INTRODUCTION

Lecture 24: More Reductions (1997) Steven Skiena. skiena

1 Unweighted Set Cover

Exam problems for the course Combinatorial Optimization I (DM208)

Design and Analysis of Algorithms. Comp 271. Mordecai Golin. Department of Computer Science, HKUST

CS270 Combinatorial Algorithms & Data Structures Spring Lecture 19:

Theorem 2.9: nearest addition algorithm

D. Θ nlogn ( ) D. Ο. ). Which of the following is not necessarily true? . Which of the following cannot be shown as an improvement? D.

Greedy Algorithms CHAPTER 16

Introduction to Algorithms December 16, 2011 Massachusetts Institute of Technology Fall 2011 Professors Erik Demaine and Srini Devadas

Week 11: Minimum Spanning trees

Recitation 4: Elimination algorithm, reconstituted graph, triangulation

NP-Completeness. Algorithms

Transcription:

UNIVERSITY OF TORONTO Department of Computer Science April 2014 Final Exam CSC373H1S Robert Robere Duration - 3 hours No Aids Allowed. PLEASE COMPLETE THE SECTION BELOW AND THE SECTION BEHIND THIS PAGE: First Name: Last Name: Exam Instructions Check that your exam book has 19 pages (including this cover page and 4 blank pages at the end). The last 4 pages are for rough work only, they will not be marked. Please bring any discrepancy to the attention of an invigilator. There are 8 questions worth a total of 115 points. Answer all questions on the question booklet. For Questions 4, 5, 6, and 7, if you do not know how to answer a part of the question then you can leave that part blank or write I DON T KNOW. to receive 20 percent of the points for that part. To pass this course you must achieve at least 40% on this final exam. Course Specific Notes Unless stated otherwise, you can use the standard data structures and algorithms discussed in CSC263 and in the lectures without describing their implementation by simply stating their standard name (e.g. min-heap, mergesort, DFS, Dijkstra). You do not need to provide any explanation or pseudo-code for their implementation. You can also use their running time without proof. For example, if you are using the merge-sort in your algorithm you can simply state that merge-sort s worst-case running time is O(n log n). If you modify a data structure or an algorithm from class, you must describe the modification and its effects. In some questions you will be given a computational problem and then asked to design an efficient algorithm for it. Unless stated otherwise, for data structures and algorithms that you design you should provide a short high-level explanation of how your algorithm works in plain English, and the pseudo-code for your algorithm in a style similar to those we have seen in the lectures. If you miss any of these the answer might not be marked. If you draw a picture of a spooky monster on the back of this exam you will receive one extra bonus mark. Your answers will be marked based on the efficiency of your algorithms and the clarity of your explanations. State the running time of your algorithm with a brief argument supporting your claim and prove that your algorithm works correctly (i.e. finds an optimal solution). Page 1/19

PLEASE PRINT YOUR STUDENT NUMBER AND YOUR NAME Student Number: First Name: Last Name: The section below is for marker s use only. Do NOT use it for answering or as scratch paper. Question # Score/Points 1 / 12 2 / 7 3 / 12 4 / 4 5 / 20 6 / 20 7 / 20 8 / 20 Total / 115 Page 2/19

1. Problem Definitions [12] Define the inputs and outputs of each of the following problems. a. All-Pairs Shortest Paths [3] Input: Output: b. Independent Set [3] Input: Output: c. Circuit SAT [3] Input: Output: d. Matrix Chain Multiplication [3] Input: Output: Page 3/19

2. Algorithm Definitions [7] a. State the names of two algorithms studied in this class that solve the single-source shortest paths problem. [2] b. What distinguishes each of these algorithms from one another? [2] c. State the Max-Flow/Min-Cut theorem, and briefly describe at a high level what it means. [3] Page 4/19

3. Complexity Theory Give a formal definition for each of the following topics/mathematical objects that we [12] examined in complexity theory. a. Karp reductions [3] b. NP [3] c. NP-Hardness [3] d. Decision Problem [3] 4. Algorithmic Paradigms [4] As stated in class and in the lecture notes, what are the two distinguishing features (or hallmarks ) of dynamic programming algorithms? Page 5/19

5. Frugal Flying [20] You are a helicopter pilot for the FIRST-ACE helicopter company, and you have just been assigned to a new contract. The details of the contract are kept hidden (for super-secret security purposes), but you know this: you have been given a particular road to monitor (of length, for some positive integer ). Every hour you will be sent a list of non-intersecting intervals on the road that you need to monitor (that is, a list of integer pairs I = {I 1,I 2,...,I n }, where I j =[s Ij,f Ij ] œ Z 2, with 1 Æ s I <f I Æ for all I) with a subtly-installed spy-cam on the bottom of your helicopter. Each pair [s Ij,f Ij ] represents a set of integer points on the road Ós Ij,s Ij +1,s Ij +2,...,f Ij 1,f IJ Ô that you need to film with your camera. You may assume that the intervals are sorted in increasing order by start time s I. Unfortunately, due to budget cuts, your spy-cam only has a limited amount of film, and once it turns on it can never be turned off. In particular, it can only film a stretch of the road of length f œ Z. You can, however, choose when to turn it on for example, if you choose to turn on the spy-cam at point x on the road, then it will film all of the integer points {x, x +1,x+2,...,x+ f 1}. When the spy-cam turns off you have to return to the start to re-load your film. Before you start to fly, then, your job is to figure out "start points" for filming on the road so that you can cover all of the input road-intervals I while minimizing the number of flights used. Input: A positive integer œ Z representing the length of the road, a positive integer f representing the length of film your spy-camera takes, and a list of intervals I where for all I =[s I,f I ] œiwe have 1 Æ s I <f I Æ. Output: The minimum number of film reloads needed to cover all of the points in the input intervals. Note that you do not need to return the actual filming points. a. Give a greedy algorithm solving the Frugal Flying problem. Assuming that k is the number of points in [10] the longest interval in the input, then to receive full marks your algorithm must run in O(nk/f) time. Be sure to give a brief, high-level description of your algorithm, a pseudocode implementation, and an argument about the running time. Page 6/19

b. Prove that your greedy algorithm is optimal. [10] Page 7/19

Page 8/19

6. Smile! [20] In this problem you will follow one of your deepest and most secret dreams: being a camera person at the Super Bowl! This year, the Super Bowl is being held in the Circleville Circle Dome (one of those famous circular football fields you hear about all the time). You are in charge of capturing any interesting, bizarre, or otherwise remarkable events which happens in the bleachers of the stadium in between the ball-foot action. To do this, you will be seated in a rotating camera booth in the exact center of the Circle Dome. The camera can rotate to the left or right at a rate of radians per second. (Assume that when you begin the camera is oriented at 0 radians). From the announcer booth you will receive a list of n events, where a single event is defined by a pair E i =(fl i,t i ), where 0 Æ fl i < 2fi is the angle (calculated counter-clockwise from your starting orientation at 0 radians) at which the ith event is happening, and t i tells you when you need to take a picture of the event. To take a picture of the ith event, your camera booth must be at the angle of fl i (counter-clockwise) from 0 at time t i. In this problem, given a list of n events L = {E 1,E 2,...,E n }, you must return the maximum number of events that you can film. Camera Booth Input: A positive real number, and a list of n events L = {E 1,E 2,...,E n }, as defined above. Output: The maximum number of events that you can capture if your camera booth starts facing at 0 radians and it can rotate clockwise or counter-clockwise at a speed of radians per second. Give a dynamic programming algorithm for this problem. To receive full marks it must run in O(n 2 ) time. a. Give a high-level description of each cell in the recurrence used by your algorithm. [4] b. Formally define the recurrence relation for the recurrence you gave in Part (a). [6] Page 9/19

c. Give a dynamic programming algorithm implementing the recurrence relation. Be sure to give a brief, [5] high-level description of your algorithm, a pseudocode implementation, and an argument about the running time. Page 10/19

d. Prove that the recurrence relation you defined in Parts (a) and (b) is correct. [5] Page 11/19

7. Vertex Cover with Edge Costs [20] Consider the following generalization of the vertex cover problem. You are given an undirected graph G =(V,E), along with positive vertex costs w u for all u œ V and positive edge costs c uv for all edges (u, v) œ E. As before, you want to find a subset of vertices S V so that every edge in the graph G is covered (i.e. has at least one of its vertices) in the set S. However, you may also leave some edges uncovered, but for every edge (u, v) left uncovered by a subset of vertices S, you must pay a penalty of c uv for that edge. The cost of a subset of vertices S will be the sum of the weights of all of the vertices in S, plus the cost of edges not covered by S: cost(s) = ÿ w u + ÿ c uv. uœs Weighted Vertex Cover with Edge Penalties (u,v)œs u,v œs Input: An undirected graph G =(V,E). Positive real vertex weights w u for each vertex u œ V and positive real edge costs c uv for each edge (u, v) œ E. Output: A set of vertices S V such that is minimized. cost(s) = ÿ w u + uœs ÿ (u,v)œe u,v œs a. Give a {0, 1}-integer programming formulation for this problem. [10] c uv Page 12/19

b. What constraints would have to be changed in order to find the linear programming relaxation of the [2] integer program in Part (a)? c. Give a rounding scheme for the linear programming relaxation of your integer program from Part (a). [8] (That is, provide a method of rounding the variables in a solution to the relaxed linear program to a solution of the integer program from Part (a).) Prove that the rounded solution will be a solution to the integer program, and also show that the rounded solution gives a bounded approximation ratio for the Weighted Vertex Cover with Edge Penalties problem. To receive full marks, your rounding scheme must attain a 1/3-approximation. Page 13/19

8. Clique [20] Recall that if G =(V,E) is an undirected graph, then a k-clique is a subset of k vertices C V such that for all u, v œ C there is an undirected edge (u, v) œ E. Clique Input: A positive integer k, and an undirected graph G =(V,E). Output: Output 1 if the graph G contains a clique with at least k vertices. a. Prove that the Clique problem is in NP, by giving a polynomial time many-one reduction to some [8] NP-Complete problem (other than the Clique problem, of course). b. Prove that the Clique problem is NP-Hard by a reduction from the 3-SAT problem. [12] Page 14/19

Page 15/19

This page is for rough work only, it will not be graded. More space for rough work is available on the next page. Page 16/19

This page is for rough work only, it will not be graded. More space for rough work is available on the next page. Page 17/19

This page is for rough work only, it will not be graded. More space for rough work is available on the next page. Page 18/19

This page is for rough work only, it will not be graded. Total Marks = (115) Total Pages = (19) Page 19/19