首页 > 其他 > 详细

[CTCI] Fobonacci Problem

时间:2015-08-12 21:38:12      阅读:271      评论:0      收藏:0      [点我收藏+]

The problem is well known, so there is no need to repeat it!

we can apply the iteration function f(n+1) = f(n)+f(n-1), however the time complexity is O(N).

We can reduce the time compexity to O(log(N)) using the method below.

f(1)=1,f(2)=1

$\begin{matrix}

f(n)&f(n-1)&\\

0& 0\\

\end{matrix}$

[CTCI] Fobonacci Problem

原文:http://www.cnblogs.com/deepblueme/p/4725425.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!