Adobe Interview Question for Software Engineer / Developers






Comment hidden because of low score. Click to expand.
2
of 2 vote

It is exponential and is a very good example showing how recursion can be bad at times. In such cases memoization is used to memorize what we have already computed and use it in further operations.

- gauravk.18 June 28, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
2
of 2 vote

Really some good solutions and discussions.

stackoverflow.com/questions/360748/computational-complexity-of-fibonacci-sequence

- Psycho September 27, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 2 vote

time complexity: o(n) , as I think we will have to get to 1 from any n, what so ever is given to us.
The space complexity is O(n) too, due to the recursive calls, for n>1 , we have 2 calls to fibo(n-1)and fibo(n-2) i.e. for every n we have 2*n recursive calls. But since we are talking about big O analysis we will not go into constant terms and therefore it is just O(n)

- Miss N April 21, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

shouldn't this be exponential? 2^n?

n -----------------2^0
/ \
n-1 n-2 -----------------2^1
/ \ / \
(n-1)-1 (n-1)-2 (n-2)-1 (n-2)-2 -----------------2^2


so the complexity is 2^0+2^1+....+2^n which is 2^n

- Anonymous April 21, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

I think you are right, i think I was just too eager to answer without thinking about the this.

- Miss N April 22, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Its n*logn

- Rashid May 27, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

shouldn't this be exponential? 2^n?

n -----------------2^0
/ \
n-1 n-2 -----------------2^1
/ \ / \
(n-1)-1 (n-1)-2 (n-2)-1 (n-2)-2 -----------------2^2


so the complexity is 2^0+2^1+....+2^n which is 2^n

- Anonymous April 21, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

correct...i second u..

- Prince July 22, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

If you see, it is going to generate Binary tree recursively...so 2^n-1

- Algorithmist April 21, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Ans would be n+1

- S May 02, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

yo its a exponential problem solution sucha a really good example to show how sometimes the recursion is bad for programming just if he memorization is present there then not a problem at all :)

- geeks July 05, 2011 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More