Solutions to assignment 3

Similar documents
Graduate Algorithms CS F-18 Flow Networks

CS3510 Design & Analysis of Algorithms Fall 2017 Section A. Test 3 Solutions. Instructor: Richard Peng In class, Wednesday, Nov 15, 2017

CSC 373: Algorithm Design and Analysis Lecture 9

Maximum Flow. Flow Graph

Bipartite Matching. Matching. Bipartite Matching. Maxflow Formulation

Chapter Introduction. 2. Linear Combinations [4.1]

Lecture 2: Network Flow. c 14

ALG 5.3 Flow Algorithms:

1 The Network Flow Problem

LAPLACE TRANSFORMS. 1. Basic transforms

Sph3u Practice Unit Test: Kinematics (Solutions) LoRusso

Problem Set If all directed edges in a network have distinct capacities, then there is a unique maximum flow.

Fall 2014 David Wagner 10/31 Notes. The min-cut problem. Examples

Jonathan Turner Exam 2-10/28/03

5. Network flow. Network flow. Maximum flow problem. Ford-Fulkerson algorithm. Min-cost flow. Network flow 5-1

Network Flows: Introduction & Maximum Flow

Minimum Squared Error

Minimum Squared Error

Released Assessment Questions, 2017 QUESTIONS

Motion. Part 2: Constant Acceleration. Acceleration. October Lab Physics. Ms. Levine 1. Acceleration. Acceleration. Units for Acceleration.

can be viewed as a generalized product, and one for which the product of f and g. That is, does

Maximum Flow and Minimum Cut

A LOG IS AN EXPONENT.

Algorithmic Discrete Mathematics 6. Exercise Sheet

The solution is often represented as a vector: 2xI + 4X2 + 2X3 + 4X4 + 2X5 = 4 2xI + 4X2 + 3X3 + 3X4 + 3X5 = 4. 3xI + 6X2 + 6X3 + 3X4 + 6X5 = 6.

e t dt e t dt = lim e t dt T (1 e T ) = 1

Flow networks. Flow Networks. A flow on a network. Flow networks. The maximum-flow problem. Introduction to Algorithms, Lecture 22 December 5, 2001

( ) ( ) ( ) ( ) ( ) ( y )

Admin MAX FLOW APPLICATIONS. Flow graph/networks. Flow constraints 4/30/13. CS lunch today Grading. in-flow = out-flow for every vertex (except s, t)

Section 5: Chain Rule

ENGR 1990 Engineering Mathematics The Integral of a Function as a Function

More on Magnetically C Coupled Coils and Ideal Transformers

Max Flow, Min Cut COS 521. Kevin Wayne Fall Soviet Rail Network, Cuts. Minimum Cut Problem. Flow network.

Flow Networks Alon Efrat Slides courtesy of Charles Leiserson with small changes by Carola Wenk. Flow networks. Flow networks CS 445

Section P.1 Notes Page 1 Section P.1 Precalculus and Trigonometry Review

graph of unit step function t

Bisimulation, Games & Hennessy Milner logic p.1/32

Robust Network Coding for Bidirected Networks

6/3/2009. CS 244 Algorithm Design Instructor: t Artur Czumaj. Lecture 8 Network flows. Maximum Flow and Minimum Cut. Minimum Cut Problem.

Soviet Rail Network, 1955

CSC 364S Notes University of Toronto, Spring, The networks we will consider are directed graphs, where each edge has associated with it

The Shortest Path Problem Graph Algorithms - 3

DC Miniature Solenoids KLM Varioline

Contraction Mapping Principle Approach to Differential Equations

! Abstraction for material flowing through the edges. ! G = (V, E) = directed graph, no parallel edges.

a) Read over steps (1)- (4) below and sketch the path of the cycle on a P V plot on the graph below. Label all appropriate points.

Randomized Perfect Bipartite Matching

Introduction to Congestion Games

Algorithm Design and Analysis

CIT 596 Theory of Computation 1. Graphs and Digraphs

Chapter 2 The Derivative Applied Calculus 107. We ll need a rule for finding the derivative of a product so we don t have to multiply everything out.

5.1-The Initial-Value Problems For Ordinary Differential Equations

Designing A Fanlike Structure

The Residual Graph. 12 Augmenting Path Algorithms. Augmenting Path Algorithm. Augmenting Path Algorithm

PHYSICS 1210 Exam 1 University of Wyoming 14 February points

4.8 Improper Integrals

Solutions for Assignment 2

Math 2142 Exam 1 Review Problems. x 2 + f (0) 3! for the 3rd Taylor polynomial at x = 0. To calculate the various quantities:

Today: Max Flow Proofs

The Residual Graph. 11 Augmenting Path Algorithms. Augmenting Path Algorithm. Augmenting Path Algorithm

The Covenant Renewed. Family Journal Page. creation; He tells us in the Bible.)

( ) ( ) ( ) ( u) ( u) = are shown in Figure =, it is reasonable to speculate that. = cos u ) and the inside function ( ( t) du

EECE 301 Signals & Systems Prof. Mark Fowler

Chapter 2: Evaluative Feedback

Y 0.4Y 0.45Y Y to a proper ARMA specification.

Homework 5 for BST 631: Statistical Theory I Solutions, 09/21/2006

CS 491G Combinatorial Optimization Lecture Notes

INTEGRALS. Exercise 1. Let f : [a, b] R be bounded, and let P and Q be partitions of [a, b]. Prove that if P Q then U(P ) U(Q) and L(P ) L(Q).

Counting Paths Between Vertices. Isomorphism of Graphs. Isomorphism of Graphs. Isomorphism of Graphs. Isomorphism of Graphs. Isomorphism of Graphs

Now we must transform the original model so we can use the new parameters. = S max. Recruits

ANSWERS TO EVEN NUMBERED EXERCISES IN CHAPTER 2

Topics in Combinatorial Optimization May 11, Lecture 22

Introduction to AC Power, RMS RMS. ECE 2210 AC Power p1. Use RMS in power calculations. AC Power P =? DC Power P =. V I = R =. I 2 R. V p.

Graphs III - Network Flow

Some basic notation and terminology. Deterministic Finite Automata. COMP218: Decision, Computation and Language Note 1

CS4445/9544 Analysis of Algorithms II Solution for Assignment 1

Analysis of Members with Axial Loads and Moments. (Length effects Disregarded, Short Column )

Physics 240: Worksheet 16 Name

SOLUTIONS TO ECE 3084

I 3 2 = I I 4 = 2A

Price Discrimination

Predator - Prey Model Trajectories and the nonlinear conservation law

Algorithms and Data Structures 2011/12 Week 9 Solutions (Tues 15th - Fri 18th Nov)

1 PYTHAGORAS THEOREM 1. Given a right angled triangle, the square of the hypotenuse is equal to the sum of the squares of the other two sides.

SLOW INCREASING FUNCTIONS AND THEIR APPLICATIONS TO SOME PROBLEMS IN NUMBER THEORY

MAXIMUM FLOW. introduction Ford-Fulkerson algorithm maxflow-mincut theorem

t + t sin t t cos t sin t. t cos t sin t dt t 2 = exp 2 log t log(t cos t sin t) = Multiplying by this factor and then integrating, we conclude that

SOLUTIONS TO TRIAL EXAMINATION 3

Some Basic Information about M-S-D Systems

Arrow s Impossibility Theorem

Phys 110. Answers to even numbered problems on Midterm Map

Chapter 2. First Order Scalar Equations

Pythagoras Theorem. The area of the square on the hypotenuse is equal to the sum of the squares on the other two sides

Challenge Problems. DIS 203 and 210. March 6, (e 2) k. k(k + 2). k=1. f(x) = k(k + 2) = 1 x k

t is a basis for the solution space to this system, then the matrix having these solutions as columns, t x 1 t, x 2 t,... x n t x 2 t...

Network Flow. Data Structures and Algorithms Andrei Bulatov

4/12/12. Applications of the Maxflow Problem 7.5 Bipartite Matching. Bipartite Matching. Bipartite Matching. Bipartite matching: the flow network

0 for t < 0 1 for t > 0

Maximum Flow in Planar Graphs

Seminar 4: Hotelling 2

Transcription:

D Sruure n Algorihm FR 6. Informik Sner, Telikeplli WS 03/04 hp://www.mpi-.mpg.e/~ner/oure/lg03/inex.hml Soluion o ignmen 3 Exerie Arirge i he ue of irepnie in urreny exhnge re o rnform one uni of urreny ino more hn one uni of he me urreny. For exmple, uppoe h U.S. ollr uy 0.7 Briih poun, Briih poun uy 9.5 Frenh frn, n Frenh frn uy 0.6 U.S. ollr. Then y onvering urrenie, rer n r wih U.S. ollr n uy 0.7 9.5 0.6 =.064 U.S. ollr, hu urning profi of 6.4 peren. Suppoe h we re given n urrenie,,..., n n n n le R of exhnge re, uh h one uni of urreny i uy R[i, j] uni of urreny j. () Give n effiien lgorihm o eermine wheher or no here exi equene of urrenie i, i,..., ik uh h R[i, i ] R[i, i 3 ] R[i k, i k ] R[i k, i ] >. Anlyze he running ime of your lgorihm. () Give n effiien lgorihm o prin ou uh equene if one exi. Anlyze he running ime of your lgorihm. Hin: k i= x i = e P k i= ln x i. Furhermore, k i= x i > iff / k i= x i <. Soluion: Thi prolem n e inerpree grph prolem: Eh urreny i noe n eh poiiliy of exhnge eween wo urrenie i n ege. The ege re weighe y he exhnge re. The queion i: Doe here exi yle in he grph, uh h he prou of he ege weigh i greer hn? Sine he known grph lgorihm re eigne o minimize he um of he ege weigh ine of mximizing heir prou, we ue he following f: x x x k > () x x x k < () ln( ) x x x k < ln() (3) ln( x ) + ln( x ) + + ln( x n ) < 0 (4) If he ege weigh x re reple y ln( x ), hen he prolem reue o fining negive yle. ) We n ue vrin of he Floy-Wrhll-Algorihm for eermining he exiene of negive yle: (oninue on he nex pge)

proeure hnegcy((v,e,) : WeigheGrph) : oolen n := r(v ) ine : Arry [0,...n][0,...n] of Rel // Fill up mrix wih eful vlue for i:=0 o n o for j:=0 o n o if (i, j) E hen ine[i][j]:=(i,j) ele ine[i][j]:=+oo // Loop ll noe for k:=0 o n o // Loop ll pir of noe for i:=0 o n o for j:=0 o n o // Cn noe k help in onruing he ph from i o j? if ine[i][j]>ine[i][k]+ine[k,j] hen ine[i][j] := ine[i][k]+ine[k][j] // Chek ou negive vlue poiion (i,i) for i:=0 o n o if ine[i][i] < 0 hen reurn rue reurn fle Thi lgorihm ue hree nee loop over n noe. Hene, i running ime i O(n 3 ). ) In orer o eermine he noe of he negive yle, he ove rouine h o e moifie uh h i memorize he hore ph: proeure negcy((v,e,) : WeigheGrph) : Li of Li of Noe n := r(v ) ine : Arry [0,...n][0,...n] of Rel // Thi rry ell where o go nex in orer o go from noe i o noe j nexnoe : Arry[0,...n ][0,...n ] of Noe // Fill up mrie wih eful vlue for i:=0 o n o for j:=0 o n o if (i, j) E hen ine[i][j]:=(i,j) nexnoe[i][j]:=j ele ine[i][j]:=+oo nexnoe[i][j]:=nil // Loop ll noe for k:=0 o n o // Loop ll pir of noe for i:=0 o n o for j:=0 o n o // Cn noe k help in onruing he ph from i o j? if ine[i][j] > ine[i][k]+ine[k,j] hen ine[i][j] := ine[i][k]+ine[k][j] nexnoe[i][j] := nexnoe[i][k]

// Conru reul reul : Li of Li of Noe := // Chek ou negive vlue poiion (i,i) for i:=0 o n o if ine[i][i]<0 hen negy : Li of Noe := < i > // Follow nexnoe unil i h een rehe gin runnoe := i repe runnoe := nexnoe[runnoe][i] negy.puhbk(runnoe) unil runnoe==i reul.puhfron(negy) reurn reul The running ime of hi lgorihm i ill O(n 3 ), eue he nexnoe-loop loop n ime mximum. Exerie Conier he grph G n he flow f given on he righ. () I f loking flow? () Give he reiul grph G f. 3/ / /0 4/ () Give he lyere ugrph L f of G f. () Fin n ugmening ph n give he reuling ugmene flow. Repe unil he flow i mximum. (e) Give ure (, )-u for he mximum flow. Soluion: () 3/ / /0 4/ Every ph from o mhe eiher he pern,,..., or he pern,,,...,, where he ege (, ) n he ege (, ) re ure. Hene, he flow f i loking eue on every ph from o one ege i ure. ()

() () ugmening ph:,,,,,, δ = reuling ugmene flow: /0 4/3 3/ (e) S = {, } Exerie 3 Whih of he following lim re rue n whih re fle. Juify your nwer y giving eiher (hor) proof or ounerexmple. () In ny mximum flow here re no yle h rry poiive flow. (A yle e,..., e k rrie poiive flow iff f(e ) > 0,..., f(e k ) > 0.) Soluion Fle. Counerexmple: () There lwy exi mximum flow wihou yle rrying poiive flow. Soluion True. Le f e mximum flow n le C e yle wih poiive flow. Le δ = min e C f(e). Reuing he flow of eh ege in C y δ minin he vlue of he flow n e he flow f(e) of le one of he ege e C o zero. () If ll ege in grph hve iin piie, here i unique mximum flow. Soluion Fle. Counerexmple: /0 4/0 3/ / 4/ 3/0 () In iree grph wih mo one ege eween eh pir of verie, if we reple eh iree ege y n uniree ege, he mximum flow vlue remin unhnge. Soluion Fle. Counerexmple: (e) If we muliply ll ege piie y poiive numer λ, he minimum u remin unhnge. Soluion True. The vlue of every u ge muliplie y λ. Thu, he relive orer of u oe no hnge.

(f) If we poiive numer λ o ll ege piie, he minimum u remin unhnge. Soluion Fle. Counerexmple: λ = / 5/5 4/3 3/3 (g) If we poiive numer λ o ll ege piie, he mximum flow inree y muliple of λ. Soluion Fle. In he exmple ove, he mximum flow hnge y 3.