# Problem Set 7 Solutions

Save this PDF as:

Size: px
Start display at page:

## Transcription

1 8 8 Introduction to Algorithms May 7, 2004 Massachusetts Institute of Technology 6.046J/18.410J Professors Erik Demaine and Shafi Goldwasser Handout 25 Problem Set 7 Solutions This problem set is due in recitation on Friday, May 7. Reading: Chapter 22, 24, , Chapters 34, 35 There are five problems. Each problem is to be done on a separate sheet (or sheets) of paper. Mark the top of each sheet with your name, the course number, the problem number, your recitation section, the date, and the names of any students with whom you collaborated. As on previous assignments, give an algorithm entails providing a description, proof, and runtime analysis. Problem 7-1. Arbitrage Arbitrage is the use of discrepancies in currency exchange rates to transform one unit of a currency into more than one unit of the same currency. Suppose, U.S. dollar bought Euro, Euro bought Japanese Yen, Japanese Yen bought Turkish Lira, and one Turkish Lira bought U.S. dollars. Then, by converting currencies, a trader can start with U.S. dollar and buy U.S. dollars, thus turning a profit. Suppose that we are given currencies and an! table " of exchange rates, such that one unit of currency \$ buys "&%(' *)+ units of currency -,. (a) Give an efficient algorithm to determine whether or not there exists a sequence of currencies. 0/213 \$ 5436 such that: "&%(' ' 7+98 "&%(' ';: "&%<';=3> ';= +98 "&%('?= ' Solution: We can use the Bellman-Ford algorithm on a suitable weighted, directed graph B C D;E FHG, which we form as follows. There is one vertex in E for each currency, and for each pair of currencies 3 and -,, there are directed edges DJI K I,3G and DJI,L I JG. (Thus, M ENMCO and M F M CQP 7R.) To determine edge weights, we start by observing that "&%(' ' 7+S8 "&%(' ';: +888 "&%<';=3> ';= +S8 "&%('?= ' if and only if "&%(' T ' -+ "&%(' ';: "&%<';=3> ';= + "&%('?= ' *+VU

2 C 2 Handout 25: Problem Set 7 Solutions Taking logs of both sides of the inequality above, we express this condition as "&%<' T ' + "&%(' ';: + "&%<';=3> ';= + Therefore, if we define the weight of edge DJI * I,TG as D I K I,3G "&%<' *)+ C "&%<' K) "&%<';= ' + U then we want to find whether there exists a negative-weight cycle in B with these edge weights. We can determine whether there exists a negative-weight cycle in B by adding an extra vertex I with -weight edges DJI I G for all I E, running BELLMAN-FORD from I, and using the boolean result of BELLMAN-FORD (which is TRUE if there are no negative-weight cycles and FALSE if there is a negative-weight cycle) to guide our answer. That is, we invert the boolean result of BELLMAN-FORD. This method works because adding the new vertex I with -weight edges from I to all other vertices cannot introduce any new cycles, yet it ensures that all negativeweight cycles are reachable from I. It takes &D G time to create B, which has DJ G edges. Then it takes DJ : G time to run BELLMAN-FORD. Thus, the total time is D : G. Another way to determine whether a negative-weight cycle exists is to create B and, without adding I and its incident edges, run either of the all-pairs shortest-paths algorithms. If the resulting shortest-path distance matrix has any negative values on the diagonal, then there is a negative-weight cycle. (b) Give an efficient algorithm to print out such a sequence if one exists. Analyze the running time of your algorithm. Solution: Assuming that we ran BELLMAN-FORD to solve part (a), we only need to find the vertices of a negative-weight cycle. We can do so as follows. First, relax all the edges once more. Since there is a negative-weight cycle, the value of some vertex will change. We just need to repeatedly follow the values until we get back to. In other words, we can use the recursive method given by the PRINT-PATH procedure of Section 22.2 in CLRS, but stop it when it returns to vertex. The running time is D : G to run BELLMAN-FORD, plus D G to print the vertices of the cycle, for a total of D : G time. Problem 7-2. Bicycle Tour Planning

3 C Handout 25: Problem Set 7 Solutions 3 You are in charge of planning cycling vacations for a travel agent. You have a map of cities connected by direct bike routes. A bike route connecting cities I and has distance D I G. Additionally, it costs D I G to stay in city I for a single night. A customer will provide you with the following data: G % + - A starting city. - A destination city. - A trip length. - A daily maximum biking distance D, where. Your job is to plan a tour that takes exactly days, such that the customer does not stay in the same city two consecutive nights and does not bike more than D G on day. Your customer can bike through several cities on a given day, i.e. there doesn t have to be a direct route between the cities you assign on day and day. You also want to minimize the total cost of staying at the cities on your tour. Give an DJ D G-G time algorithm to produce an -city tour D C I I minimum cost DJI G, such that D I > I JG D ' G. I G with Solution: First, compute the all-pairs shortest path distances DJ' *) G among every pair of cities ' and ). Store the values in a table. Then construct a directed acyclic graph with D G nodes. The nodes are labeled as I, for ' \$- and \$. Each node I corresponds to the option of staying at city ' on day. For any ' *) \$- where ' C ) and, add the edge DJI > I,LG in the graph if D ' K)G D G. This means that the customer can bike from city ' to city ) without exceeding the daily limit. Also, for each node I, assign a node cost T to the node. The lowest cost tour is simply the path from I! to I"\$ where the total node cost is minimum. If I "\$ is not reachable from I!, no tour satisfying the requirements exists. We can transform the minimum node cost path problem into a shortest path problem easily. Since the graph is directed, for every edge D I G we can assign the cost of node I as its edge weight. This reduces the problem to a shortest path problem, which can be computed using the shortest path algorithm on DAGs (see Section 24.2 in CLRS). Correctness: A path on the graph from I! to I"\$ corresponds to a bicycle tour for the days. Specifically, each edge D I % > I,LG along the path specifies a day trip from city ' to city ) on day. Note that the edge is present in if and only if the corresponding day trip does not violate daily mileage constraint. Also, since there is no edge between D I > * I G for any ' in the graph, the customer will not stay at the same city on consecutive nights. The transformation of the minimum node-cost path problem into the shortest path problem preserves the cost of corresponding paths (with an offest of the cost of the source node). Therefore the shortest path algorithm on the transformed graph will compute the tour with the lowest cost.

4 U U U : 4 Handout 25: Problem Set 7 Solutions Running Time: The all-pairs shortest paths distances can be computed in D : G time using the Floyd-Warshall algorithm. The graph contains D G nodes and DJ G edges, so it takes DJ G time to construct the graph. Since is a DAG, the shortest path on can be computed in DJ G time. Therefore the overall running time is DJ G C D D G G. Problem 7-3. P vs. NP Suppose that T and that. For each of the following statements, determine whether it is true, false, or an open problem. Prove your answers. (a) If, then. Solution: If C, then this is true. Otherwise, this is false: can be NPcomplete. Therefore this is an open question. (b) If, then. Solution: True. Proof presented in lecture. (c) is either NP-complete or is in P. Solution: Open. There exist problems that are in NP, but are not known NP-complete. If C this is true. If C then it is false. (d) If, then both and are NP-complete. Solution: If C, then this is true, since then any problem in is -complete. Otherwise, it is false: we can take T, and they are not NP-complete. Therefore, this is an open problem. (e) If and are both NP-complete, then. Solution: True by definition of NP-completeness. (f) Suppose there is a linear time algorithm that recognizes. Then there exists a linear time algorithm to recognize. Solution: False. The reduction from to, although polynomial, may take more than linear time. Subtle Point: This does not necessarily imply that no linear time reduction from to exists. Essentially, this problem is equivalent to asking whether there exist any

5 Handout 25: Problem Set 7 Solutions 5 problems with superlinear lower bounds in P. That happens to be true: there do exist problems in P that cannot be solved in linear time. This is beyond the context of Students will get full credit for the correct answer with incomplete justification. Problem 7-4. NP-Completeness (a) Suppose you are given an algorithm to solve the CLIQUE decision problem. That is, D?B G will decide whether graph B has a clique of size. Give an algorithm to find the vertices of a -clique in a graph B using only calls to, if any such -clique exists. Solution: Run D?B G. If returns false, then exit. Otherwise if returns true, remove an arbitrary vertex I from the graph. Run D B I G. If now returns false, then I must be in all remaining -cliques. If returns true, there exists some -clique without I. Continue this process until vertices are found that must necessarily be in the -clique. (b) Prove that the following decision problem is NP-complete. LARGEST-COMMON-SUBGRAPH: Given two graphs B and B and an integer, determine whether there is a graph B with edges which is a subgraph of both B and B. (Hint: reduce from CLIQUE.) Solution: The problem is in NP: to prove that B C D?E F G and B C D;E FVG share a subgraph of size at least, one can exhibit a graph C D?E F G with at least edges, and 1-1 mappings E E and E E. Thus the certificate has size M M M M M M. If is the size of the input M MC D G, since is a subgraph of the given graphs, and M M C D G since each of them is just a list of vertices. Therefore, the size of the certificate is polynomial. To verify this certificate, check that has at least edges ( DJ G time), check that and are 1-1 ( DJ G time), and check whether for any edge D I G F, D D GT DJI G-G F and D D GT D I G-G FV ( D G time). Therefore the certificate takes polynomial time to verify. Reduction: Given a graph B and an integer, to determine whether B has a clique of size, ask whether B and = have a common subgraph with D G edges, where = is the complete graph on nodes. (c) Suppose you are given an algorithm to solve the LARGEST-COMMON-SUBGRAPH decision problem. Give an algorithm to find a subgraph of size that appears in both graphs B and B, using only calls to, if any such subgraph exists.

6 6 Handout 25: Problem Set 7 Solutions Solution: Use an approach similar to the reduction from Decisional-Clique to Search- Clique. Run D?B T B G. If says a subgraph exists, try removing an edge from either B or B and re-running. If s output has changed, that edge must appear in all remaining subgraphs. Otherwise, it can be excluded. Problem 7-5. Maximum Coverage Approximation Suppose you are given a set of size M MCO, a collection of distinct subsets T where, and a number as input. We would like to pick subsets from the collection that cover the maximum number of elements in. Give a greedy, polynomial-time approx-, where imiation algorithm for this maximum coverage problem with ratio bound of C M M. Analyze the approximation ratio achieved by your algorithm. Solution: The following greedy algorithm achieves the ratio bound. GREEDY-MAXIMUM-COVERAGE( ): for ' to 4 select a that maximizes M M return The algorithm works as follows. At each stage, the algorithm picks a subset A and store it in the collection. The set contains, at each stage, the set of uncovered elements. The greedy approach at line 4 picks the subset that covers as many uncovered elements as possible. The algorithm can easily be implemented in time polynomial in, and. The number of iterations on lines 3-6 is. Each iteration can be implemented in D G time. Therefore there is G. an implementation that runs in time DJ The algorithm has a ratio bound. Let be the solution given by the algorithm, and be the optimal solution. If covers the entire set, then is the optimal solution and we are done. Therefore, we consider the case where does not cover the entire. At the first iteration, the algorithm will pick the largest subset with size. Therefore the number of elements covered by will be at least. Also, at each stage, the algorithm will pick at subset that covers at least one element that has not been previously covered. Therefore, the number of elements covered by will also be at least. To sum up, the solution will cover at least elements. Now consider the optimal solution. The optimcal solution contains subsets, and each subset contains at most elements. Therefore the maximum number of elements covered by is. It follows that the ratio bound of the greedy algorithm is:

7 C Handout 25: Problem Set 7 Solutions 7

### Outline. NP-completeness. When is a problem easy? When is a problem hard? Today. Euler Circuits

Outline NP-completeness Examples of Easy vs. Hard problems Euler circuit vs. Hamiltonian circuit Shortest Path vs. Longest Path 2-pairs sum vs. general Subset Sum Reducing one problem to another Clique

### 2.3 Scheduling jobs on identical parallel machines

2.3 Scheduling jobs on identical parallel machines There are jobs to be processed, and there are identical machines (running in parallel) to which each job may be assigned Each job = 1,,, must be processed

### Cpt S 223. School of EECS, WSU

The Shortest Path Problem 1 Shortest-Path Algorithms Find the shortest path from point A to point B Shortest in time, distance, cost, Numerous applications Map navigation Flight itineraries Circuit wiring

### Lecture 7: NP-Complete Problems

IAS/PCMI Summer Session 2000 Clay Mathematics Undergraduate Program Basic Course on Computational Complexity Lecture 7: NP-Complete Problems David Mix Barrington and Alexis Maciel July 25, 2000 1. Circuit

### CMPSCI611: Approximating MAX-CUT Lecture 20

CMPSCI611: Approximating MAX-CUT Lecture 20 For the next two lectures we ll be seeing examples of approximation algorithms for interesting NP-hard problems. Today we consider MAX-CUT, which we proved to

### Introduction to Algorithms Review information for Prelim 1 CS 4820, Spring 2010 Distributed Wednesday, February 24

Introduction to Algorithms Review information for Prelim 1 CS 4820, Spring 2010 Distributed Wednesday, February 24 The final exam will cover seven topics. 1. greedy algorithms 2. divide-and-conquer algorithms

### Near Optimal Solutions

Near Optimal Solutions Many important optimization problems are lacking efficient solutions. NP-Complete problems unlikely to have polynomial time solutions. Good heuristics important for such problems.

### Algorithm Design and Analysis

Algorithm Design and Analysis LECTURE 27 Approximation Algorithms Load Balancing Weighted Vertex Cover Reminder: Fill out SRTEs online Don t forget to click submit Sofya Raskhodnikova 12/6/2011 S. Raskhodnikova;

### Guessing Game: NP-Complete?

Guessing Game: NP-Complete? 1. LONGEST-PATH: Given a graph G = (V, E), does there exists a simple path of length at least k edges? YES 2. SHORTEST-PATH: Given a graph G = (V, E), does there exists a simple

### Discrete Mathematics, Chapter 3: Algorithms

Discrete Mathematics, Chapter 3: Algorithms Richard Mayr University of Edinburgh, UK Richard Mayr (University of Edinburgh, UK) Discrete Mathematics. Chapter 3 1 / 28 Outline 1 Properties of Algorithms

### NP-complete? NP-hard? Some Foundations of Complexity. Prof. Sven Hartmann Clausthal University of Technology Department of Informatics

NP-complete? NP-hard? Some Foundations of Complexity Prof. Sven Hartmann Clausthal University of Technology Department of Informatics Tractability of Problems Some problems are undecidable: no computer

### Quiz 2 Solutions. Solution: False. Need stable sort.

Introduction to Algorithms April 13, 2011 Massachusetts Institute of Technology 6.006 Spring 2011 Professors Erik Demaine, Piotr Indyk, and Manolis Kellis Quiz 2 Solutions Problem 1. True or false [24

### 2. (a) Explain the strassen s matrix multiplication. (b) Write deletion algorithm, of Binary search tree. [8+8]

Code No: R05220502 Set No. 1 1. (a) Describe the performance analysis in detail. (b) Show that f 1 (n)+f 2 (n) = 0(max(g 1 (n), g 2 (n)) where f 1 (n) = 0(g 1 (n)) and f 2 (n) = 0(g 2 (n)). [8+8] 2. (a)

### 5.1 Bipartite Matching

CS787: Advanced Algorithms Lecture 5: Applications of Network Flow In the last lecture, we looked at the problem of finding the maximum flow in a graph, and how it can be efficiently solved using the Ford-Fulkerson

### NP-Completeness. CptS 223 Advanced Data Structures. Larry Holder School of Electrical Engineering and Computer Science Washington State University

NP-Completeness CptS 223 Advanced Data Structures Larry Holder School of Electrical Engineering and Computer Science Washington State University 1 Hard Graph Problems Hard means no known solutions with

### Why? A central concept in Computer Science. Algorithms are ubiquitous.

Analysis of Algorithms: A Brief Introduction Why? A central concept in Computer Science. Algorithms are ubiquitous. Using the Internet (sending email, transferring files, use of search engines, online

### Applied Algorithm Design Lecture 5

Applied Algorithm Design Lecture 5 Pietro Michiardi Eurecom Pietro Michiardi (Eurecom) Applied Algorithm Design Lecture 5 1 / 86 Approximation Algorithms Pietro Michiardi (Eurecom) Applied Algorithm Design

### Reductions & NP-completeness as part of Foundations of Computer Science undergraduate course

Reductions & NP-completeness as part of Foundations of Computer Science undergraduate course Alex Angelopoulos, NTUA January 22, 2015 Outline Alex Angelopoulos (NTUA) FoCS: Reductions & NP-completeness-

### Minimum cost maximum flow, Minimum cost circulation, Cost/Capacity scaling

6.854 Advanced Algorithms Lecture 16: 10/11/2006 Lecturer: David Karger Scribe: Kermin Fleming and Chris Crutchfield, based on notes by Wendy Chu and Tudor Leu Minimum cost maximum flow, Minimum cost circulation,

### Approximation Algorithms

Approximation Algorithms or: How I Learned to Stop Worrying and Deal with NP-Completeness Ong Jit Sheng, Jonathan (A0073924B) March, 2012 Overview Key Results (I) General techniques: Greedy algorithms

### Linear Programming. March 14, 2014

Linear Programming March 1, 01 Parts of this introduction to linear programming were adapted from Chapter 9 of Introduction to Algorithms, Second Edition, by Cormen, Leiserson, Rivest and Stein [1]. 1

### Algorithm Design and Analysis Homework #6 Due: 1pm, Monday, January 9, === Homework submission instructions ===

Algorithm Design and Analysis Homework #6 Due: 1pm, Monday, January 9, 2012 === Homework submission instructions === Submit the answers for writing problems (including your programming report) through

### Unit 4: Layout Compaction

Unit 4: Layout Compaction Course contents Design rules Symbolic layout Constraint-graph compaction Readings: Chapter 6 Unit 4 1 Design rules: restrictions on the mask patterns to increase the probability

### Data Structures and Algorithms Written Examination

Data Structures and Algorithms Written Examination 22 February 2013 FIRST NAME STUDENT NUMBER LAST NAME SIGNATURE Instructions for students: Write First Name, Last Name, Student Number and Signature where

### Computer Algorithms. NP-Complete Problems. CISC 4080 Yanjun Li

Computer Algorithms NP-Complete Problems NP-completeness The quest for efficient algorithms is about finding clever ways to bypass the process of exhaustive search, using clues from the input in order

### Chapter 4. Trees. 4.1 Basics

Chapter 4 Trees 4.1 Basics A tree is a connected graph with no cycles. A forest is a collection of trees. A vertex of degree one, particularly in a tree, is called a leaf. Trees arise in a variety of applications.

### Solutions to Exercises 8

Discrete Mathematics Lent 2009 MA210 Solutions to Exercises 8 (1) Suppose that G is a graph in which every vertex has degree at least k, where k 1, and in which every cycle contains at least 4 vertices.

### COLORED GRAPHS AND THEIR PROPERTIES

COLORED GRAPHS AND THEIR PROPERTIES BEN STEVENS 1. Introduction This paper is concerned with the upper bound on the chromatic number for graphs of maximum vertex degree under three different sets of coloring

### ! Solve problem to optimality. ! Solve problem in poly-time. ! Solve arbitrary instances of the problem. !-approximation algorithm.

Approximation Algorithms Chapter Approximation Algorithms Q Suppose I need to solve an NP-hard problem What should I do? A Theory says you're unlikely to find a poly-time algorithm Must sacrifice one of

### COT5405 Analysis of Algorithms Homework 3 Solutions

COT0 Analysis of Algorithms Homework 3 Solutions. Prove or give a counter example: (a) In the textbook, we have two routines for graph traversal - DFS(G) and BFS(G,s) - where G is a graph and s is any

### Memoization/Dynamic Programming. The String reconstruction problem. CS125 Lecture 5 Fall 2016

CS125 Lecture 5 Fall 2016 Memoization/Dynamic Programming Today s lecture discusses memoization, which is a method for speeding up algorithms based on recursion, by using additional memory to remember

### ! Solve problem to optimality. ! Solve problem in poly-time. ! Solve arbitrary instances of the problem. #-approximation algorithm.

Approximation Algorithms 11 Approximation Algorithms Q Suppose I need to solve an NP-hard problem What should I do? A Theory says you're unlikely to find a poly-time algorithm Must sacrifice one of three

### Introduction to Algorithms March 10, 2004 Massachusetts Institute of Technology Professors Erik Demaine and Shafi Goldwasser Quiz 1.

Introduction to Algorithms March 10, 2004 Massachusetts Institute of Technology 6.046J/18.410J Professors Erik Demaine and Shafi Goldwasser Quiz 1 Quiz 1 Do not open this quiz booklet until you are directed

### CMSC 451: Graph Properties, DFS, BFS, etc.

CMSC 451: Graph Properties, DFS, BFS, etc. Slides By: Carl Kingsford Department of Computer Science University of Maryland, College Park Based on Chapter 3 of Algorithm Design by Kleinberg & Tardos. Graphs

### 1. Sorting (assuming sorting into ascending order) a) BUBBLE SORT

DECISION 1 Revision Notes 1. Sorting (assuming sorting into ascending order) a) BUBBLE SORT Make sure you show comparisons clearly and label each pass First Pass 8 4 3 6 1 4 8 3 6 1 4 3 8 6 1 4 3 6 8 1

### The Goldberg Rao Algorithm for the Maximum Flow Problem

The Goldberg Rao Algorithm for the Maximum Flow Problem COS 528 class notes October 18, 2006 Scribe: Dávid Papp Main idea: use of the blocking flow paradigm to achieve essentially O(min{m 2/3, n 1/2 }

### Modelling for Constraint Programming

Modelling for Constraint Programming Barbara Smith 2. Implied Constraints, Optimization, Dominance Rules CP Summer School 28 Implied Constraints Implied constraints are logical consequences of the set

### Graph Theory. Introduction. Distance in Graphs. Trees. Isabela Drămnesc UVT. Computer Science Department, West University of Timişoara, Romania

Graph Theory Introduction. Distance in Graphs. Trees Isabela Drămnesc UVT Computer Science Department, West University of Timişoara, Romania November 2016 Isabela Drămnesc UVT Graph Theory and Combinatorics

### Duration Must be Job (weeks) Preceeded by

1. Project Scheduling. This problem deals with the creation of a project schedule; specifically, the project of building a house. The project has been divided into a set of jobs. The problem is to schedule

### Chapter 4: Trees. 2. Theorem: Let T be a graph with n vertices. Then the following statements are equivalent:

9 Properties of Trees. Definitions: Chapter 4: Trees forest - a graph that contains no cycles tree - a connected forest. Theorem: Let T be a graph with n vertices. Then the following statements are equivalent:

### Lecture 3. Linear Programming. 3B1B Optimization Michaelmas 2015 A. Zisserman. Extreme solutions. Simplex method. Interior point method

Lecture 3 3B1B Optimization Michaelmas 2015 A. Zisserman Linear Programming Extreme solutions Simplex method Interior point method Integer programming and relaxation The Optimization Tree Linear Programming

### Graphs and Network Flows IE411 Lecture 1

Graphs and Network Flows IE411 Lecture 1 Dr. Ted Ralphs IE411 Lecture 1 1 References for Today s Lecture Required reading Sections 17.1, 19.1 References AMO Chapter 1 and Section 2.1 and 2.2 IE411 Lecture

### A. V. Gerbessiotis CS Spring 2014 PS 3 Mar 24, 2014 No points

A. V. Gerbessiotis CS 610-102 Spring 2014 PS 3 Mar 24, 2014 No points Problem 1. Suppose that we insert n keys into a hash table of size m using open addressing and uniform hashing. Let p(n, m) be the

### Bicolored Shortest Paths in Graphs with Applications to Network Overlay Design

Bicolored Shortest Paths in Graphs with Applications to Network Overlay Design Hongsik Choi and Hyeong-Ah Choi Department of Electrical Engineering and Computer Science George Washington University Washington,

### Informatique Fondamentale IMA S8

Informatique Fondamentale IMA S8 Cours 4 : graphs, problems and algorithms on graphs, (notions of) NP completeness Laure Gonnord http://laure.gonnord.org/pro/teaching/ Laure.Gonnord@polytech-lille.fr Université

### Sample Problems in Discrete Mathematics

Sample Problems in Discrete Mathematics This handout lists some sample problems that you should be able to solve as a pre-requisite to Computer Algorithms Try to solve all of them You should also read

### Homework 15 Solutions

PROBLEM ONE (Trees) Homework 15 Solutions 1. Recall the definition of a tree: a tree is a connected, undirected graph which has no cycles. Which of the following definitions are equivalent to this definition

### Lecture 3: Linear Programming Relaxations and Rounding

Lecture 3: Linear Programming Relaxations and Rounding 1 Approximation Algorithms and Linear Relaxations For the time being, suppose we have a minimization problem. Many times, the problem at hand can

Approximation Algorithms Chapter Approximation Algorithms Q. Suppose I need to solve an NP-hard problem. What should I do? A. Theory says you're unlikely to find a poly-time algorithm. Must sacrifice one

### Graph. Consider a graph, G in Fig Then the vertex V and edge E can be represented as:

Graph A graph G consist of 1. Set of vertices V (called nodes), (V = {v1, v2, v3, v4...}) and 2. Set of edges E (i.e., E {e1, e2, e3...cm} A graph can be represents as G = (V, E), where V is a finite and

### Final Exam Solutions

Introduction to Algorithms May 19, 2011 Massachusetts Institute of Technology 6.006 Spring 2011 Professors Erik Demaine, Piotr Indyk, and Manolis Kellis Final Exam Solutions Problem 1. Final Exam Solutions

### CSE 101: Design and Analysis of Algorithms Homework 4 Winter 2016 Due: February 25, 2016

CSE 101: Design and Analysis of Algorithms Homework 4 Winter 2016 Due: February 25, 2016 Exercises (strongly recommended, do not turn in) 1. (DPV textbook, Problem 7.11.) Find the optimal solution to the

### Minimize subject to. x S R

Chapter 12 Lagrangian Relaxation This chapter is mostly inspired by Chapter 16 of [1]. In the previous chapters, we have succeeded to find efficient algorithms to solve several important problems such

### The Knapsack Problem. Decisions and State. Dynamic Programming Solution Introduction to Algorithms Recitation 19 November 23, 2011

The Knapsack Problem You find yourself in a vault chock full of valuable items. However, you only brought a knapsack of capacity S pounds, which means the knapsack will break down if you try to carry more

### Introduction to Algorithms. Part 3: P, NP Hard Problems

Introduction to Algorithms Part 3: P, NP Hard Problems 1) Polynomial Time: P and NP 2) NP-Completeness 3) Dealing with Hard Problems 4) Lower Bounds 5) Books c Wayne Goddard, Clemson University, 2004 Chapter

### Lecture 15 An Arithmetic Circuit Lowerbound and Flows in Graphs

CSE599s: Extremal Combinatorics November 21, 2011 Lecture 15 An Arithmetic Circuit Lowerbound and Flows in Graphs Lecturer: Anup Rao 1 An Arithmetic Circuit Lower Bound An arithmetic circuit is just like

### Minimum Spanning Trees

Minimum Spanning Trees Algorithms and 18.304 Presentation Outline 1 Graph Terminology Minimum Spanning Trees 2 3 Outline Graph Terminology Minimum Spanning Trees 1 Graph Terminology Minimum Spanning Trees

### Approximation Algorithms: LP Relaxation, Rounding, and Randomized Rounding Techniques. My T. Thai

Approximation Algorithms: LP Relaxation, Rounding, and Randomized Rounding Techniques My T. Thai 1 Overview An overview of LP relaxation and rounding method is as follows: 1. Formulate an optimization

### Linear Programming. April 12, 2005

Linear Programming April 1, 005 Parts of this were adapted from Chapter 9 of i Introduction to Algorithms (Second Edition) /i by Cormen, Leiserson, Rivest and Stein. 1 What is linear programming? The first

### Fairness in Routing and Load Balancing

Fairness in Routing and Load Balancing Jon Kleinberg Yuval Rabani Éva Tardos Abstract We consider the issue of network routing subject to explicit fairness conditions. The optimization of fairness criteria

### Scheduling. Open shop, job shop, flow shop scheduling. Related problems. Open shop, job shop, flow shop scheduling

Scheduling Basic scheduling problems: open shop, job shop, flow job The disjunctive graph representation Algorithms for solving the job shop problem Computational complexity of the job shop problem Open

### Answers to some of the exercises.

Answers to some of the exercises. Chapter 2. Ex.2.1 (a) There are several ways to do this. Here is one possibility. The idea is to apply the k-center algorithm first to D and then for each center in D

### Lecture 7: Approximation via Randomized Rounding

Lecture 7: Approximation via Randomized Rounding Often LPs return a fractional solution where the solution x, which is supposed to be in {0, } n, is in [0, ] n instead. There is a generic way of obtaining

### 1 Definitions. Supplementary Material for: Digraphs. Concept graphs

Supplementary Material for: van Rooij, I., Evans, P., Müller, M., Gedge, J. & Wareham, T. (2008). Identifying Sources of Intractability in Cognitive Models: An Illustration using Analogical Structure Mapping.

### Lecture Notes on Spanning Trees

Lecture Notes on Spanning Trees 15-122: Principles of Imperative Computation Frank Pfenning Lecture 26 April 26, 2011 1 Introduction In this lecture we introduce graphs. Graphs provide a uniform model

### Math 443/543 Graph Theory Notes 4: Connector Problems

Math 443/543 Graph Theory Notes 4: Connector Problems David Glickenstein September 19, 2012 1 Trees and the Minimal Connector Problem Here is the problem: Suppose we have a collection of cities which we

### Scheduling Home Health Care with Separating Benders Cuts in Decision Diagrams

Scheduling Home Health Care with Separating Benders Cuts in Decision Diagrams André Ciré University of Toronto John Hooker Carnegie Mellon University INFORMS 2014 Home Health Care Home health care delivery

### princeton univ. F 13 cos 521: Advanced Algorithm Design Lecture 6: Provable Approximation via Linear Programming Lecturer: Sanjeev Arora

princeton univ. F 13 cos 521: Advanced Algorithm Design Lecture 6: Provable Approximation via Linear Programming Lecturer: Sanjeev Arora Scribe: One of the running themes in this course is the notion of

### Single machine parallel batch scheduling with unbounded capacity

Workshop on Combinatorics and Graph Theory 21th, April, 2006 Nankai University Single machine parallel batch scheduling with unbounded capacity Yuan Jinjiang Department of mathematics, Zhengzhou University

### Complexity Theory. IE 661: Scheduling Theory Fall 2003 Satyaki Ghosh Dastidar

Complexity Theory IE 661: Scheduling Theory Fall 2003 Satyaki Ghosh Dastidar Outline Goals Computation of Problems Concepts and Definitions Complexity Classes and Problems Polynomial Time Reductions Examples

### Theorem A graph T is a tree if, and only if, every two distinct vertices of T are joined by a unique path.

Chapter 3 Trees Section 3. Fundamental Properties of Trees Suppose your city is planning to construct a rapid rail system. They want to construct the most economical system possible that will meet the

### One last point: we started off this book by introducing another famously hard search problem:

S. Dasgupta, C.H. Papadimitriou, and U.V. Vazirani 261 Factoring One last point: we started off this book by introducing another famously hard search problem: FACTORING, the task of finding all prime factors

### Discuss the size of the instance for the minimum spanning tree problem.

3.1 Algorithm complexity The algorithms A, B are given. The former has complexity O(n 2 ), the latter O(2 n ), where n is the size of the instance. Let n A 0 be the size of the largest instance that can

### Definition 11.1. Given a graph G on n vertices, we define the following quantities:

Lecture 11 The Lovász ϑ Function 11.1 Perfect graphs We begin with some background on perfect graphs. graphs. First, we define some quantities on Definition 11.1. Given a graph G on n vertices, we define

### Dynamic Programming. Applies when the following Principle of Optimality

Dynamic Programming Applies when the following Principle of Optimality holds: In an optimal sequence of decisions or choices, each subsequence must be optimal. Translation: There s a recursive solution.

### 15-750 Graduate Algorithms Spring 2010

15-750 Graduate Algorithms Spring 2010 1 Cheap Cut (25 pts.) Suppose we are given a directed network G = (V, E) with a root node r and a set of terminal nodes T V. We would like to remove the fewest number

### Analysis of Algorithms, I

Analysis of Algorithms, I CSOR W4231.002 Eleni Drinea Computer Science Department Columbia University Thursday, February 26, 2015 Outline 1 Recap 2 Representing graphs 3 Breadth-first search (BFS) 4 Applications

### Midterm Practice Problems

6.042/8.062J Mathematics for Computer Science October 2, 200 Tom Leighton, Marten van Dijk, and Brooke Cowan Midterm Practice Problems Problem. [0 points] In problem set you showed that the nand operator

### Answer Key for California State Standards: Algebra I

Algebra I: Symbolic reasoning and calculations with symbols are central in algebra. Through the study of algebra, a student develops an understanding of the symbolic language of mathematics and the sciences.

### Welcome to... Problem Analysis and Complexity Theory 716.054, 3 VU

Welcome to... Problem Analysis and Complexity Theory 716.054, 3 VU Birgit Vogtenhuber Institute for Software Technology email: bvogt@ist.tugraz.at office hour: Tuesday 10:30 11:30 slides: http://www.ist.tugraz.at/pact.html

### Approximation Algorithms. Scheduling. Approximation algorithms. Scheduling jobs on a single machine

Approximation algorithms Approximation Algorithms Fast. Cheap. Reliable. Choose two. NP-hard problems: choose 2 of optimal polynomial time all instances Approximation algorithms. Trade-off between time

### Social Media Mining. Graph Essentials

Graph Essentials Graph Basics Measures Graph and Essentials Metrics 2 2 Nodes and Edges A network is a graph nodes, actors, or vertices (plural of vertex) Connections, edges or ties Edge Node Measures

### DO NOT RE-DISTRIBUTE THIS SOLUTION FILE

Professor Kindred Math 04 Graph Theory Homework 7 Solutions April 3, 03 Introduction to Graph Theory, West Section 5. 0, variation of 5, 39 Section 5. 9 Section 5.3 3, 8, 3 Section 7. Problems you should

### CS5314 Randomized Algorithms. Lecture 16: Balls, Bins, Random Graphs (Random Graphs, Hamiltonian Cycles)

CS5314 Randomized Algorithms Lecture 16: Balls, Bins, Random Graphs (Random Graphs, Hamiltonian Cycles) 1 Objectives Introduce Random Graph Model used to define a probability space for all graphs with

### 1 Basic Definitions and Concepts in Graph Theory

CME 305: Discrete Mathematics and Algorithms 1 Basic Definitions and Concepts in Graph Theory A graph G(V, E) is a set V of vertices and a set E of edges. In an undirected graph, an edge is an unordered

### 1. Nondeterministically guess a solution (called a certificate) 2. Check whether the solution solves the problem (called verification)

Some N P problems Computer scientists have studied many N P problems, that is, problems that can be solved nondeterministically in polynomial time. Traditionally complexity question are studied as languages:

### 8.1 Makespan Scheduling

600.469 / 600.669 Approximation Algorithms Lecturer: Michael Dinitz Topic: Dynamic Programing: Min-Makespan and Bin Packing Date: 2/19/15 Scribe: Gabriel Kaptchuk 8.1 Makespan Scheduling Consider an instance

### Permutation Betting Markets: Singleton Betting with Extra Information

Permutation Betting Markets: Singleton Betting with Extra Information Mohammad Ghodsi Sharif University of Technology ghodsi@sharif.edu Hamid Mahini Sharif University of Technology mahini@ce.sharif.edu

### Part 2: Community Detection

Chapter 8: Graph Data Part 2: Community Detection Based on Leskovec, Rajaraman, Ullman 2014: Mining of Massive Datasets Big Data Management and Analytics Outline Community Detection - Social networks -

### Exponential time algorithms for graph coloring

Exponential time algorithms for graph coloring Uriel Feige Lecture notes, March 14, 2011 1 Introduction Let [n] denote the set {1,..., k}. A k-labeling of vertices of a graph G(V, E) is a function V [k].

### SIMS 255 Foundations of Software Design. Complexity and NP-completeness

SIMS 255 Foundations of Software Design Complexity and NP-completeness Matt Welsh November 29, 2001 mdw@cs.berkeley.edu 1 Outline Complexity of algorithms Space and time complexity ``Big O'' notation Complexity

### 1. What s wrong with the following proofs by induction?

ArsDigita University Month : Discrete Mathematics - Professor Shai Simonson Problem Set 4 Induction and Recurrence Equations Thanks to Jeffrey Radcliffe and Joe Rizzo for many of the solutions. Pasted

### 8.1 Min Degree Spanning Tree

CS880: Approximations Algorithms Scribe: Siddharth Barman Lecturer: Shuchi Chawla Topic: Min Degree Spanning Tree Date: 02/15/07 In this lecture we give a local search based algorithm for the Min Degree

### The Theory of Network Tracing

The Theory of Network Tracing H. B. Acharya M. G. Gouda Department of Computer Science Department of Computer Science University of Texas at Austin University of Texas at Austin Student author : H. B.

### Discrete Mathematics Problems

Discrete Mathematics Problems William F. Klostermeyer School of Computing University of North Florida Jacksonville, FL 32224 E-mail: wkloster@unf.edu Contents 0 Preface 3 1 Logic 5 1.1 Basics...............................

### 6.852: Distributed Algorithms Fall, 2009. Class 2

.8: Distributed Algorithms Fall, 009 Class Today s plan Leader election in a synchronous ring: Lower bound for comparison-based algorithms. Basic computation in general synchronous networks: Leader election

### Good luck, veel succes!

Final exam Advanced Linear Programming, May 7, 13.00-16.00 Switch off your mobile phone, PDA and any other mobile device and put it far away. No books or other reading materials are allowed. This exam

### A simpler and better derandomization of an approximation algorithm for Single Source Rent-or-Buy

A simpler and better derandomization of an approximation algorithm for Single Source Rent-or-Buy David P. Williamson Anke van Zuylen School of Operations Research and Industrial Engineering, Cornell University,