Solution Review: Find the Greatest Common Divisor
Explore the use of recursion to solve the problem of finding the greatest common divisor (GCD) of two numbers. Understand the recursive algorithm that simplifies the calculation by reducing the problem step-by-step, and follow the explanation of how recursion breaks down the GCD computation effectively.
We'll cover the following...
We'll cover the following...
Solution: Using Recursion
Explanation
The brute force approach to finding of numbers would be to list all their divisors, pick the common divisors, and then select the greatest of them. However, a mathematical simplification can make this task easier.
The process of calculating is as follows: If , then ...