Vidyalelo
Data Structure · Q589

Miscellaneous on Data Structures

Programming · Data Structure · question 589

Q589

The time complexity of the following recursive implementation to find the factorial of a number is . . . . . . . . int fact(int n) if(_________) return 1; return n * fact(n - 1); int main() int n = 5; int ans = fact(n); printf("%d",ans); return 0;

A.
O(1)
B.
O(n)
Answer
C.
O(n2)
D.
O(n3)

Answer: Option B

Solution

Answer: Option B
No explanation is given for this question Let's Discuss on Board