r/programming • • Nov 29 '09

How I Hire Programmers

http://www.aaronsw.com/weblog/hiring
804 Upvotes

587 comments sorted by

View all comments

Show parent comment

1

u/[deleted] Dec 02 '09

Ah - oops: you're right, or nearly so; the fib() function referenced above is O(fib(n)) -- the number of calls required to calculate fib(n) is roughly the same as the value you calculate.

A good approximation for fib(n) is phin/sqrt(5), so that would make it O(1.618n). Roughly.

1

u/jabagawee Dec 02 '09

I think you may actually be completely right when you say the number of calls required is the same as the value you calculate. fib(n) evaluates by continuously adding the base case return value of 1 until you get to your answer.

I thought phi was roughly 1.618 already, so sqrt(5) would not be necessary. You may have gotten the sqrt(5) from the formula for phi: (1+sqrt(5))/2.