Q.

Which of the following implementations of Catalan numbers has the smallest time complexity?

A. dynamic programming
B. binomial coefficients
C. recursion
D. all have equal time complexity
Answer» B. binomial coefficients
Explanation: The time complexities are as follows:
Dynamic programming: O(n2) Recursion: Exponential Binomial coefficients: O(n).
4.4k
0
Do you find this helpful?
1

Discussion

No comments yet