Question: in java please 1) Programming: Implement the GCD (Greater Common Divisor) Algorithm Input: Two positive integers, m and n Output: The GCD of m and

in java pleasein java please 1) Programming: Implement the GCD (Greater Common Divisor) Algorithm

1) Programming: Implement the GCD (Greater Common Divisor) Algorithm Input: Two positive integers, m and n Output: The GCD of m and n While (r+m mod n) 0 men ner Output 2) Verification/Debugging: Check the correctness of the algorithm for the following values of m and n: (m, n): (14, 21) (56, 32) (63, 99) (210, 54) (1240, 735) Show the output of your implementation: m, n, ged(m, n). Verify the correctness of the output by hand. Show your work. 3) Instrumentation: Modify your implementation of ged(m, n) to create a function gedlterations(m, n) that returns the number of times the while loop is executed. 4) Exploration: Generate pairs of positive integers (m, n) using a nested loop to find the iterations used by worst case m for each n. See below. Record and plot the results. On the same graph, plot the function 2[log nl // Create an array maxIterations with indices 0 to 100. // Initialized to zeroes. // Index O not used for m-1 to 100 for n-1 tom maxIterations[n] = max(maxIterations[n], gedlterations(m, n)) // Plot n going from 1 to 100 on the x axis, // and two curves on the y-axis: y = maxIterations[n) and y-2 [log ni. 5) Hypothesis Generation: So... looking at the graph you generated, what observations can you make? In particular, what do you notice about the relationship between the two curves (e.g., no apparent relationship, intersecting, not intersecting, one always greater, always equal, etc.)? Can you find a bounding formula y=f(n) that is better than y = 2log n

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!