...
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)
0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
error: Alert: Content selection is disabled!!