Interview Question

Interview Seattle, WA

Describe how recursion isn't always efficient.


Interview Answer

3 Answers


Stack frames consume memory by having local variables in each frame stored. Also asked what can be contained in the stack frame (such as local variables - mem addr and return addr).

Interview Candidate on Jan 23, 2014

Stackoverflow problem when recursion is deep but can be solved by tail recursion

Anonymous on Jan 29, 2014

In certain problems such as Fibonacci, sub-problems are computed more than once with recursive method. It would be more efficient with dynamic programming.

Yidan on Feb 24, 2014

Add Answers or Comments

To comment on this, Sign In or Sign Up.