Question: using python (a) Write a function alt_gcd (a,b) that returns the gcd of a, b (where a, b are positive integers), but do NOT use
using python
(a) Write a function alt_gcd (a,b) that returns the gcd of a, b (where a, b are positive integers), but do NOT use the Euclidean algorithm. Rather, use the factoring function you wrote for last homework (or some modification of it); recall that itf we know the prime factorizations of both a, b, we can find the gcd by looking at the smaller power of each prime that occurs in each of a, b. (b) Let f(n) be the maximum of the running time of your alt_gcd (a,b) function, where a, b range over all pairs of n digit numbers. Using timed experiments, guess the rough order of growth off(n) as n oo (ie, is it logarithmitic, linear, quadratic, exponential)? The % time and time commands may be useful for doing the timing
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
