Question: Trace through the following algorithm, if it is invoked as GCD ( 3 0 , 1 6 ) . Use a top - down evaluation.

Trace through the following algorithm, if it is invoked as GCD(30,16). Use a top-down evaluation. (Recall that "n mod m" is the remainder when n is divided by m.)
function GCD(m, n {0,1,2,3,})
if
n =0
thenreturn melsereturn GCD(n, m mod 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 Programming Questions!