|
[原创]递归计算斐波那契数列时间复杂度之彻底分析
其实楼主你最后的方法看上去挺好,但有个致命弱点,就是精度问题。 既然是 根式的n次方,那么在进行乘方运算后必然精度不准。 其实,斐波那契数列的计算机算法正确的应该是 矩阵快速幂相乘。 设矩阵[C] 为: 1 1 0 1 0 1 1 0 0 则矩阵 (f[n] f[n-1] f[n-2]) = (1 1 2)*[C]^(n-1) 快速幂的意思是: [c]^n = ([c]^2)^n/2 这样用分治算法可以使时间复杂度降为O( logn ) |
|
[原创]递归计算斐波那契数列时间复杂度之彻底分析
一个所有学过线性代数都会的“特征方程”解线性递推式的方法 撑起了 楼主的这篇文章。。。 |
|
[求助]求助算法
楼主,以前你在群里问的时候。我貌似给出了01背包问题的规划方程,当时你说要自己研究的。 |
|
[求助]求助算法
楼主,以前你在群里问的时候。我貌似给出了01背包问题的规划方程,当时你说要自己研究的。 |
|
[分享]在帖子里给代码加上语法高亮
试验一下,看看行不行:
|
|
[原创][邀请码已发]密码学基本算法--数域筛法的改进
附上快速线性筛法: 1. #include<iostream> 2. using namespace std; 3. const long N =8388609; //N=2^23+1; 4. long prime[N] = {0},num_prime = 0; 5. int isNotPrime[N] = {1, 1}; 6. int main() 7. { 8. for(long i = 2 ; i < N ; i ++) 9. { 10. if(! isNotPrime[i]) 11. prime[num_prime ++]=i; 12. //关键处1 13. for(long j = 0 ; j < num_prime && i * prime[j] < N ; j ++) 14. { 15. isNotPrime[i * prime[j]] = 1; 16. if( !(i % prime[j])) //关键处2 17. break; 18. } 19. } 20. return 0; 21. } |
|
|
|
[原创]今晚12:00我就可以买邀请码了
我突然忘记怎么买邀请码了,,,链接找不到了呢。。杯具 |
|
[求助]如何看自己的KX值,我在苦苦等待转正
不知道KX能否转送。。。 |
|
[求助]如何看自己的KX值,我在苦苦等待转正
我已经看到了,谢谢。。 |
操作理由
RANk
{{ user_info.golds == '' ? 0 : user_info.golds }}
雪币
{{ experience }}
课程经验
{{ score }}
学习收益
{{study_duration_fmt}}
学习时长
基本信息
荣誉称号:
{{ honorary_title }}
能力排名:
No.{{ rank_num }}
等 级:
LV{{ rank_lv-100 }}
活跃值:
在线值:
浏览人数:{{ visits }}
最近活跃:{{ last_active_time }}
注册时间:{{ user_info.create_date_jsonfmt }}
勋章
兑换勋章
证书
证书查询 >
能力值