Documentation of 'edu.princeton.cs.algs4.Arbitrage' Java class
Arbitrage
edu.princeton.cs.algs4

Class Arbitrage



  • public class Arbitrage
    extends java.lang.Object
    The Arbitrage class provides a client that finds an arbitrage opportunity in a currency exchange table by constructing a complete-digraph representation of the exchange table and then finding a negative cycle in the digraph.

    This implementation uses the Bellman-Ford algorithm to find a negative cycle in the complete digraph. The running time is proportional to V3 in the worst case, where V is the number of currencies.

    For additional documentation, see Section 4.4 of Algorithms, 4th Edition by Robert Sedgewick and Kevin Wayne.

    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static void main(java.lang.String[] args)
      Reads the currency exchange table from standard input and prints an arbitrage opportunity to standard output (if one exists).
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • main

        public static void main(java.lang.String[] args)
        Reads the currency exchange table from standard input and prints an arbitrage opportunity to standard output (if one exists).
        Parameters:
        args - the command-line arguments

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.