Which of the following implementations of Catalan numbers has the largest space complexity(Don't consider the stack space)?
Dynamic programming
Binomial coefficients
Recursion
All have equal space complexities
View Answer
Correct Answer: A — Dynamic programming
Explanation:
The space complexities are as follows:
Dynamic programming: O(n)
Recursion: O(1)
Binomial coefficients: O(1).
