Functions
August 29, 2024Functions
August 29, 2024Functions
|
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)
}
|
O(log2 n)
|
|
|
O(n)
|
|
|
O(√n)
|
|
|
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)
