Class GCG
java.lang.Object
topics.divideconquer.GCG
GREATEST COMMON DIVISORS: Calculate the GCG of two positive integers
- Author:
- vicegd
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongeuclideanGCG(long a, long b) Euclidean algorithm to solve the GCG problemlongnaiveGCD(long a, long b) Naive algorithm to solve the GCG problem
-
Constructor Details
-
GCG
public GCG()
-
-
Method Details
-
naiveGCD
public long naiveGCD(long a, long b) Naive algorithm to solve the GCG problem- Parameters:
a- First numberb- Second number- Returns:
- GCD
-
euclideanGCG
public long euclideanGCG(long a, long b) Euclidean algorithm to solve the GCG problem- Parameters:
a- First numberb- Second number- Returns:
- GCD
-