Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 3^^^^^^ Problem Set 9 Spring 2018, CU-Boulder Problem Set S9 3. (10 pts extra credit) Crabbe and Goyle think they have come up with

image text in transcribed

Question 3^^^^^^

Problem Set 9 Spring 2018, CU-Boulder Problem Set S9 3. (10 pts extra credit) Crabbe and Goyle think they have come up with a way to get (a) Given examples t bidirectional BFS asking for asympt rich by playing the foreign exchange markets in the wizarding world. Their idea is to exploit these exchange rates in order to transform one unit of British wizarding money into more than one unit of British wizarding money. For instance, suppose 1 wizarding penny bought 0.82 French wizarding pennis, 1 French wizarding penny bought 129.7 Russian wizarding pennies, 1 Russian wizarding penny, and one Russian wizarding penny bought 0.0008 British wizard Crabbe and Goyle think they could start with 1 British wizarding penny and buy 0.82 129.7 12 0.0008 1.02 British wizarding pennies, thereby making a 2% profit! The problem is that those gnomes at Gringots charge a transaction cost for each exchange... Suppose that Crabbe and Goyle start with knowledge of n wizard monies c1, 02,... ,Cn and an n x n table R of exchange rates, such that one unit of wizard money c buys RI, JI units of wizard money c). A traditional arbitrage opportunity is thus a cycle in the induced graph such that the product of the edge weights is greater than unity That is, a sequence of currencies (cii,Ciai... , ci,) such that R[ii, i2] x R[i2, is] x X Rlik-1,ikx R[ik,i> 1. Each transaction, however, must pay Gringots a fraction a of the total transaction value, e.g., ?-0.01 for a 1% rate of examples (Gn BFS and bidirecti as n 00 ling pennies. By converting these coins, (b) Recall that in ord track of which no state arravs, on example to show give a graph G a says there is no p (c) Implement from in the (unweighte the graph is give you may use any language libraries from s to t (-1 if off the queue dur (d) Implement froms unweighted, direc rectional BFS. A (d, k) where d is t is the number of (a) When given R and ?, give an efficient algorithm that can determine if an arbitrage opportunity exists. Analyze the running time of your algorithm. Hermione's hint: It is possible to solve this problem in O(n). Recall that Bellman- Ford can be used to detect negative-weight cycles in a graph. (b) For an arbitrary R, explain how varying a changes the set of arbitrage opportu- nities that exist and that your algorithm might identify algorithm 4. (40 pts) Bidirectional breadth-first search is a variant of standard BFS for finding a (e) For each of thef BidirectionalB shortest path between two vertices s,t E V(G). The idea is to run two breadth-first searches simultanesouly, one starting from s and one starting from t, and stop when they "meet in the middle" (that is, whenever a vertex is encountered by both searches) Simultaneously" here doesn't assume you have multiple processors at your disposal it's enough to alternate iterations of the searches: one iteration of the loop for the BFS that started at s and one iteration of the loop for the BFS that started at t . In text, thep is the output . a plot with Tu the values of i. Grids. C is Problem Set 9 Spring 2018, CU-Boulder Problem Set S9 3. (10 pts extra credit) Crabbe and Goyle think they have come up with a way to get (a) Given examples t bidirectional BFS asking for asympt rich by playing the foreign exchange markets in the wizarding world. Their idea is to exploit these exchange rates in order to transform one unit of British wizarding money into more than one unit of British wizarding money. For instance, suppose 1 wizarding penny bought 0.82 French wizarding pennis, 1 French wizarding penny bought 129.7 Russian wizarding pennies, 1 Russian wizarding penny, and one Russian wizarding penny bought 0.0008 British wizard Crabbe and Goyle think they could start with 1 British wizarding penny and buy 0.82 129.7 12 0.0008 1.02 British wizarding pennies, thereby making a 2% profit! The problem is that those gnomes at Gringots charge a transaction cost for each exchange... Suppose that Crabbe and Goyle start with knowledge of n wizard monies c1, 02,... ,Cn and an n x n table R of exchange rates, such that one unit of wizard money c buys RI, JI units of wizard money c). A traditional arbitrage opportunity is thus a cycle in the induced graph such that the product of the edge weights is greater than unity That is, a sequence of currencies (cii,Ciai... , ci,) such that R[ii, i2] x R[i2, is] x X Rlik-1,ikx R[ik,i> 1. Each transaction, however, must pay Gringots a fraction a of the total transaction value, e.g., ?-0.01 for a 1% rate of examples (Gn BFS and bidirecti as n 00 ling pennies. By converting these coins, (b) Recall that in ord track of which no state arravs, on example to show give a graph G a says there is no p (c) Implement from in the (unweighte the graph is give you may use any language libraries from s to t (-1 if off the queue dur (d) Implement froms unweighted, direc rectional BFS. A (d, k) where d is t is the number of (a) When given R and ?, give an efficient algorithm that can determine if an arbitrage opportunity exists. Analyze the running time of your algorithm. Hermione's hint: It is possible to solve this problem in O(n). Recall that Bellman- Ford can be used to detect negative-weight cycles in a graph. (b) For an arbitrary R, explain how varying a changes the set of arbitrage opportu- nities that exist and that your algorithm might identify algorithm 4. (40 pts) Bidirectional breadth-first search is a variant of standard BFS for finding a (e) For each of thef BidirectionalB shortest path between two vertices s,t E V(G). The idea is to run two breadth-first searches simultanesouly, one starting from s and one starting from t, and stop when they "meet in the middle" (that is, whenever a vertex is encountered by both searches) Simultaneously" here doesn't assume you have multiple processors at your disposal it's enough to alternate iterations of the searches: one iteration of the loop for the BFS that started at s and one iteration of the loop for the BFS that started at t . In text, thep is the output . a plot with Tu the values of i. Grids. C is

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advanced Database Systems

Authors: Carlo Zaniolo, Stefano Ceri, Christos Faloutsos, Richard T. Snodgrass, V.S. Subrahmanian, Roberto Zicari

1st Edition

155860443X, 978-1558604438

More Books

Students also viewed these Databases questions