aliensbrain
  • Home
  • Study
  • Quizzes
  • 🎤AI Practicefree
  • Notebooks
  • Community
  • Sign in
  • Test 2 Algorithms | Computer Science
  • In the following C function, let n $\ge$ m. ```c Int gcd ...
Multiple choice

In the following C function, let n $\ge$ 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. $\Theta$(log2 n)
  2. $\Omega$(n)
  3. $\Theta$(log2log2 n)
  4. $\Theta$($\sqrt n$)
Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

Keep practicing — related questions

  • What is the time complexity of the following recursive function? Int Do Something (int n) { return 1; else ...
  • Let Gcd (m,n) be a recursively defined function as given below Gcd (n,m) m<n Gcd (m,n) = m n=0 Gcd(n,m%n) o...
  • Consider the following recursive C function that takes two arguments unsigned int foo (unsigned int n, unsi...
  • Consider the following recursive C function that takes two arguments unsigned int foo (unsigned int n, unsi...
  • What is the time complexity of the following recursive function? Int Do Something (int n) { return 1; else ...
  • Consider the following C functions: int f1(int n) { If(n == 0 | | n == 1) return n; else return (2 * f1(n -...
  • Consider the following function. int unknown (int n) { int i, j, k 0; for i n / 2; i <- n; i + +) for j = 2...
  • Consider the following C functions: int f1 (int n) { If(n == 0 | |n == 1) return n; else return(2*f1(n-1) +...
Play the full quiz 🎤 Practise this topic out loud
Advertisement
© Aliensbrain | all rights reserved
  • About
  • Contact
  • Terms and Condition
  • Privacy Policy