In the following C function, let n ≥ m. int gcd(n,m) { if (n%m ==0) return m;…
PYQ Accenture 2023
In the following C function, let n ≥ m.
int gcd(n,m)
{
if (n%m ==0) return m;
n = n%m;
return gcd(m,n);
}How many recursive calls are made by this function?
- A.
Θ(log n)
- B.
Ω(n)
- C.
Θ(log log n)
- D.
Θ(√n)
Attempted by 2 students.
Sign up free to check your answer
Sign up freeLoading lesson…