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. For example, suppose that 1 U.S. dollar buys 46.4 Indian rupees, 1 Indian rupee buys 2.5 Japanese yen, and 1 Japanese yen buys 0.0091 U.S. dollars. Then, by converting currencies, a trader can start with 1 U.S. dollar and buy 46.4 × 2.5 × 0.0091 = 1.0556 U.S. dollars, thus turning a profit of 5.56 percent. Suppose that we are given n currencies c1, c2,..., cn and an n × n table R of exchange rates, such that one unit of currency ci buys R[i, j] units of currency cj.
a. Give an efficient algorithm to determine whether or not there exists a sequence of currencies (Ci1, Ci2, . . ., Cik) such that R[i1, i2] · R[i2, i3] R[ik-1, ik] · R[ik, i1] > 1. Analyze the running time of your algorithm.
b. Give an efficient algorithm to print out such a sequence if one exists. Analyze the running time of your algorithm.

  • CreatedJuly 14, 2010
  • Files Included
Post your question