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?

  1. A.

    Θ(log n)

  2. B.

    Ω(n)

  3. C.

    Θ(log log n)

  4. D.

    Θ(√n)

Attempted by 2 students.

Sign up free to check your answer

Sign up free

Explore the full course: Accenture Preparation

Loading lesson…