Class GCG

java.lang.Object
topics.divideconquer.GCG

public class GCG extends Object
GREATEST COMMON DIVISORS: Calculate the GCG of two positive integers
Author:
vicegd
  • 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 number
      b - Second number
      Returns:
      GCD
    • euclideanGCG

      public long euclideanGCG(long a, long b)
      Euclidean algorithm to solve the GCG problem
      Parameters:
      a - First number
      b - Second number
      Returns:
      GCD