...
Functions
August 29, 2024
Functions
August 29, 2024
Functions
August 29, 2024
Functions
August 29, 2024

Functions

Question 56
In the following C language function, Iet n ≥ m. How many recursive calls are made by this function ?

int gcd(n,n)

{

if(n%m ==0) return m;

n=n%n;

return gcd(n,n)

}

A
O(log2 n)
B
O(n)
C
O(√n)
D
O(log2 log2n)
Question 56 Explanation: 
If we consider worst case then it will be option a … as an example take n=11 m=8 .. it will be O(logn)
Correct Answer: A
Question 56 Explanation: 
If we consider worst case then it will be option a … as an example take n=11 m=8 .. it will be O(logn)

Leave a Reply

Your email address will not be published. Required fields are marked *