UML CS Algorithms Qualifying Exam Spring, 2004 ALGORITHMS QUALIFYING EXAM

Similar documents
UML CS Algorithms Qualifying Exam Fall, 2003 ALGORITHMS QUALIFYING EXAM

UML CS Algorithms Qualifying Exam Fall, 2004 ALGORITHMS QUALIFYING EXAM

END-TERM EXAMINATION

U.C. Berkeley CS170 : Algorithms, Fall 2013 Midterm 1 Professor: Satish Rao October 10, Midterm 1 Solutions

Lecture 22 Tuesday, April 10

Planar graphs. Chapter 8

Introduction to Graph Theory

Lecture 9 - Matrix Multiplication Equivalences and Spectral Graph Theory 1

Assignment 1 Introduction to Graph Theory CO342

Bipartite Roots of Graphs

Assignment 4 Solutions of graph problems

Part II. Graph Theory. Year

Adjacent: Two distinct vertices u, v are adjacent if there is an edge with ends u, v. In this case we let uv denote such an edge.

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

Graphs: Introduction. Ali Shokoufandeh, Department of Computer Science, Drexel University

Chapter 9 Graph Algorithms

Chapter 9 Graph Algorithms

DO NOT RE-DISTRIBUTE THIS SOLUTION FILE

Exercise 1. D-ary Tree

Module 11. Directed Graphs. Contents

Solutions to Exam Data structures (X and NV)

Theorem 2.9: nearest addition algorithm

Algorithms Activity 6: Applications of BFS

Lecture 3: Graphs and flows

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

Final. Name: TA: Section Time: Course Login: Person on Left: Person on Right: U.C. Berkeley CS170 : Algorithms, Fall 2013

CMPSCI 311: Introduction to Algorithms Practice Final Exam

Chapter 9 Graph Algorithms

CS521 \ Notes for the Final Exam

Combinatorics Summary Sheet for Exam 1 Material 2019

Math 575 Exam 3. (t). What is the chromatic number of G?

ECE608 - Chapter 16 answers

Lecture 1 (Part 1) Introduction/Overview

Thomas H. Cormen Charles E. Leiserson Ronald L. Rivest. Introduction to Algorithms

Matching Algorithms. Proof. If a bipartite graph has a perfect matching, then it is easy to see that the right hand side is a necessary condition.

HW Graph Theory SOLUTIONS (hbovik) - Q

CMSC 441 Final Exam Fall 2015

Hypercubes. (Chapter Nine)

Graphing Linear Inequalities in Two Variables.

Solution for Homework set 3

Design and Analysis of Algorithms 演算法設計與分析. Lecture 7 April 15, 2015 洪國寶

BT, BST, AVL. Web Resources page on textbook website:

Framework for Design of Dynamic Programming Algorithms

Network Flow and Matching

Decision Problems. Observation: Many polynomial algorithms. Questions: Can we solve all problems in polynomial time? Answer: No, absolutely not.

Math 454 Final Exam, Fall 2005

22 Elementary Graph Algorithms. There are two standard ways to represent a

CMSC351 - Fall 2014, Homework #4

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

Elements of Graph Theory

Problem 1. Which of the following is true of functions =100 +log and = + log? Problem 2. Which of the following is true of functions = 2 and =3?

Graph Definitions. In a directed graph the edges have directions (ordered pairs). A weighted graph includes a weight function.

CS 373: Combinatorial Algorithms, Spring 1999

P = NP; P NP. Intuition of the reduction idea:

L.J. Institute of Engineering & Technology Semester: VIII (2016)

Graphs and Discrete Structures

Module 7. Independent sets, coverings. and matchings. Contents

22 Elementary Graph Algorithms. There are two standard ways to represent a

Graph Algorithms. Chromatic Polynomials. Graph Algorithms

10/31/18. About A6, Prelim 2. Spanning Trees, greedy algorithms. Facts about trees. Undirected trees

Spanning Trees, greedy algorithms. Lecture 20 CS2110 Fall 2018

Course Introduction / Review of Fundamentals of Graph Theory

CS 350 Final Algorithms and Complexity. It is recommended that you read through the exam before you begin. Answer all questions in the space provided.

1 Format. 2 Topics Covered. 2.1 Minimal Spanning Trees. 2.2 Union Find. 2.3 Greedy. CS 124 Quiz 2 Review 3/25/18

Modules. 6 Hamilton Graphs (4-8 lectures) Introduction Necessary conditions and sufficient conditions Exercises...

Discrete Mathematics Course Review 3

Discrete Wiskunde II. Lecture 6: Planar Graphs

Combinatorics Qualifying Exam August, 2016

Give a short answer (i.e. 1 to 3 sentences) for the following questions:

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

CME 305: Discrete Mathematics and Algorithms Instructor: Reza Zadeh HW#3 Due at the beginning of class Thursday 02/26/15

Fast algorithms for max independent set

Section 8.2 Graph Terminology. Undirected Graphs. Definition: Two vertices u, v in V are adjacent or neighbors if there is an edge e between u and v.

Algebraic method for Shortest Paths problems

EECS Sample Midterm Exam

Greedy Algorithms. Previous Examples: Huffman coding, Minimum Spanning Tree Algorithms

Chapter 8. Voronoi Diagrams. 8.1 Post Oce Problem

Ph.D. Comprehensive Examination Design and Analysis of Algorithms

CS1800 Discrete Structures Final Version A

CSE101: Design and Analysis of Algorithms. Ragesh Jaiswal, CSE, UCSD

Announcements. CSEP 521 Applied Algorithms. Announcements. Polynomial time efficiency. Definitions of efficiency 1/14/2013

Lecture 2 - Graph Theory Fundamentals - Reachability and Exploration 1

MOST attention in the literature of network codes has

CMSC Theory of Algorithms Second Midterm

Polynomial-Time Approximation Algorithms

Minimum Cost Edge Disjoint Paths

Spanning Trees. Lecture 20 CS2110 Spring 2015

Math.3336: Discrete Mathematics. Chapter 10 Graph Theory

Week 11: Minimum Spanning trees

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

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

Introduction III. Graphs. Motivations I. Introduction IV

6. Algorithm Design Techniques

1 Definition of Reduction

Chapter 15 Introduction to Linear Programming

CME 305: Discrete Mathematics and Algorithms Instructor: Reza Zadeh HW#3 Due at the beginning of class Thursday 03/02/17

CPSC 536N: Randomized Algorithms Term 2. Lecture 10

Chapter 4. Relations & Graphs. 4.1 Relations. Exercises For each of the relations specified below:

Clustering Using Graph Connectivity

ECS 20 Lecture 17b = Discussion D8 Fall Nov 2013 Phil Rogaway

Transcription:

NAME: This exam is open: - books - notes and closed: - neighbors - calculators ALGORITHMS QUALIFYING EXAM The upper bound on exam time is 3 hours. Please put all your work on the exam paper. (Partial credit will only be given if your work is shown.) If you use pseudocode from a reference, such as the Cormen et al. textbook, you can just give the page reference instead of writing that pseudocode on your exam paper. All algorithms referred to here use a sequential model of computation, not a parallel one. Good luck! 1 of 24

Part 1 (85 points) Solve all of problems 1-7 1: (15 points) NP-Completeness Given: Undirected graph G = ( V, E), weight w( e) Z +, e E, bound a subset C of cliques of G. + B Z, Question: Does there exist a simple cycle in G that has total weight B and contains at most one edge from each clique in C? Either prove that this problem is NP-complete or provide a polynomial-time algorithm for solving it. 2 of 24

this page left blank for work 3 of 24

2: (10 points) Flow Networks Given a flow network G = (V, E) with source s and sink t, a cut (S,T ) is a partition of V into S and T = V S such that s S, t T. Let (S,T ) be a cut of G such that T > 1. Let s be s' t a vertex of T such that. Let G = ( T, E ) where E contains every edge e=(u,v) such that e E, u, v T. That is, E is the subgraph of G induced by T. Suppose that there exists a cut (S,T ) of G such that S' 1, T' 1, s' S', t T'. Consider the following statement about the flow network: where f ( S, T ) = f ( S, S') + f ( S', T ') f ( X, Y ) = f ( x, y) and f ( x, y) denotes the flow x X y Y from vertex x to vertex y. Either prove the statement or provide a counterexample. 4 of 24

this page left blank for work 5 of 24

3: (10 points) Graph Algorithms Given a directed, strongly connected graph G=(V,E), we can determine whether or not it contains a directed cycle of odd length as follows: - Perform Depth-First-Search (DFS) on G starting from an arbitrary vertex v. - During the DFS, mark each vertex as either even or odd. That is, we first mark v as even then, for each edge (u,w), we mark w with the opposite mark of u. - If we attempt to mark a vertex that is already marked by the opposite mark, then we conclude that there is a cycle of odd length. Can we use this approach to test for the existence of an even cycle in a directed, strongly connected graph? Why or why not? 6 of 24

this page left blank for work 7 of 24

4: (15 points) Dynamic Programming An investor has $8,000 to invest. This can be spread across 3 investment programs. Investment can only be in integral multiples of $1,000. The investor s goal is to maximize total return on investment. The return function R i (x) for x = 0,..., 8 for each of the 3 investment programs is given. Example of R i (x): Investment (in units of $1,000) 0 1 2 3 4 5 6 7 8 Program 1 0 5 15 40 80 90 95 98 100 Program 2 0 5 15 40 60 70 70 74 75 Program 3 0 4 26 40 45 50 50 52 53 Show how this investment problem can be solved using dynamic programming by establishing the optimal substructure of the optimal solution. 8 of 24

this page left blank for work 9 of 24

5: (10 points) Number-Theoretic Algorithms. a) (4pts) Find all solutions to the equations x 4 (mod 5) and x 5 (mod 11). b) (3 pts) What do the Chinese Remainder Theorem and its Corollaries allow you to say about x (mod 55)? Explain. c) (3 pts) Is the general result used in b) what you need to show that RSA is correct? Explain. 10 of 24

this page left blank for work 11 of 24

6: (10 points) Amortized Analysis. Common Lisp provides a hash table data structure which is automatically maintained by the system. At the beginning a small table is allocated. As the table becomes full, a new table twice the size is allocated, the old table is copied over and the memory allocated to it is released. Explain the comparative advantages and disadvantages of open addressing and chaining. In particular, a) (6 pts) explain (with appropriate references) why chaining will allow you to wait for the table to be full (load factor α = 1) and still maintain an amortized linear cost for insertions (sketch the proof of this part), while the open addressing scheme will force you to create a new table well before the load factor is close to 1 (explain in detail) if you want reasonable amortized linear costs. b) (4 pts) What are the implications for the strategy required to support a Delete-Table operation that allows us to contract tables with too few entries? Explain carefully, since there are at least two interacting issues to address. 12 of 24

this page left blank for work 13 of 24

7: (15 points) Greedy Approximations. Consider the problem of making change for n cents using the least number of coins. a) (3 pts) Describe a greedy algorithm to make change consisting of quarters, dimes, nickels and pennies. b) (3 pts) Prove that your algorithm yields an optimal solution. c) (2 pts) What is the time complexity of the greedy algorithm in a)? d) (3 pts) Give a set of coin denominations for which the greedy algorithm does not yield and optimal solution. Prove your assertion. e) (2 pts) What property of the set in part c) is crucial to the failure? Explain. f) (2 pts) What is the time complexity of the general make change algorithm with arbitrary coin denominations? Explain. 14 of 24

15 of 24

this page left blank for work 16 of 24

Part 2 (15 points) Solve one of problems 8-10. 8: (15 points) Linear Programming A manufacturing company operates two plants. Three suppliers are willing to supply parts to the plants in the following amounts: Supplier 1: Supplier 2: Supplier 3: 200 tons at $10/ton 300 tons at $9/ton 400 tons at $8/ton Shipping costs in dollars per ton are: TO Plant A TO Plant B FROM Supplier 1 2 2.5 FROM Supplier 2 1 1.5 FROM Supplier 3 5 3 Plant capacities and labor costs are: Plant A Plant B Capacity 450 tons 550 tons Labor Cost $25/ton $20/ton The assembled products are sold at $50/ton to distributors. The company can sell at this price all that they can produce. How should the company plan its operations at the two plants so it maximizes its profits? Formulate a linear program that solves this problem. 17 of 24

this page left blank for work 18 of 24

9: (15 points) Computational Geometry The relative neighbor graph (RNG) of a set P of points in the plane is defined as follows: Two points p and q are connected by an edge in RNG(P) if and only if: d( p, q) min r P r p, ( max( d( p, r), d( q, ))), q r where d(p,q) is the Euclidean distance between p and q. Design an algorithm that, given P, efficiently constructs RNG(P). Provide pseudocode, correctness justification and an upper bound on the worst-case asymptotic running time. Hint: Two points p and q are connected by an edge in a Gabriel Graph if and only if the circle with diameter pq does not contain any other point of P in its interior. You may assume that a procedure GG(P) is available. GG(P) returns the Gabriel Graph of P using only O(nlgn) worst-case time. The number of edges in the Gabriel Graph is guaranteed to be in O(n). You may decide which graph representation is used to store the result of GG(P). 19 of 24

this page left blank for work 20 of 24

10: (15 points) Matrix Multiplication or FFT Let M(n) be the time to multiply two n n Boolean matrices, and let T(n) be the time to find the transitive closure of an n*n Boolean matrix. Show that an M(n)-time Boolean matrix multiplication algorithm implies an O(M(n) lgn)-time transitive-closure algorithm, and a T(n)- time transitive closure algorithm implies an O(T(n))-time Boolean matrix multiplication algorithm. The proof involves filling in the details in the following steps: a) you are given that, if A is a Boolean matrix (e.g., the adjacency matrix of a graph), the Transitive Closure of A is I + A + + A n-1 = (I + A) n-1. Recall that, for Boolean matrices A + A = A and that each power of A (in the adjacency matrix interpretation) provides us with the paths of length corresponding to the power. No need to prove anything here. b) (5 pts) Prove (e.g., by induction) that, if P(n) is the fastest time to find the n-th power of an n*n matrix, then P(n) is an O(M(n) lg n)- time algorithm. c) (5 pts) What is the Transitive Closure of the Boolean matrix I n A 0 0 I n B where A and B are Boolean matrices? 0 0 I n d) (5 pts) Use the results in a), b) and c) to complete the proof. 21 of 24

22 of 24

this page left blank for work 23 of 24

this page left blank for work 24 of 24