src/com/michaelho/RandomizedAlgorithms/RA1.java
/**
         * The euclid algorithm used to calculate greatest common divisor.
         * The runtime is O(Log min(a, b))
         *
         * @param x The larger number to calculate GCD.
         * @param y The smaller number to calculate GCD.
         * @return The greatest common divisor derived by the algorithm.
         * */
The euclid algorithm used to calculate greatest common divisor.

@param x The larger number to calculate GCD.
@param y The smaller number to calculate GCD.
@return The greatest common divisor derived by the algorithm.
The euclid algorithm used to calculate greatest common divisor . @param x The larger number to calculate GCD . @param y The smaller number to calculate GCD . @return The greatest common divisor derived by the algorithm .
int euclidAlgorithm(int x, int y) {
            if (x == 0)
                return y;
            return euclidAlgorithm(y%x, x);
        }
int euclidAlgorithm ( int x , int y ) { if ( x == 0 ) return y ; return euclidAlgorithm ( y % x , x ) ; }
The euclid algorithm used to calculate greatest common divisor.
The euclid algorithm used to calculate greatest common divisor .