1.

Which of the following implementations of Catalan numbers has the largest space complexity(Don’t consider the stack space)?(a) Dynamic programming(b) Binomial coefficients(c) Recursion(d) All have equal space complexitiesThis question was posed to me in an international level competition.My question comes from Catalan Number using Dynamic Programming in division Dynamic Programming of Data Structures & Algorithms II

Answer»

The correct option is (a) DYNAMIC programming

The best I can explain: The space complexities are as FOLLOWS:

Dynamic programming: O(n)

RECURSION: O(1)

Binomial coefficients: O(1).



Discussion

No Comment Found

Related InterviewSolutions