- 博客(4)
- 收藏
- 关注
原创 Fibonacci Numbers
阅读TAOCP中Fibonacci Numbers内容后的想法。 Fibonacci Numbers,形如以下的数列 0,1,1,2,3,5,8,13,21,34, … , 在这个数列中从第三项开始,每一个元素都是前两个元素的和。 可以写成以下形式: formula1: F0 = 0; F1 = 1; Fn+2 = Fn+1 + Fn , n>=0. 由此我们就可以得到递归
2016-03-20 10:19:45 993
原创 Math
以下是书上关于数学准备的一些知识,我只摘录了一小部分。 求和 1)一下两种求和方式是等价的: int sum1(int a[],int n) { int sum=0; for(int i=0;i<n;++i) { for(int j=0;j<=i;++j) { sum+=a[i]*a[j]; } } return sum; }int sum2(int a[],in
2016-03-14 08:06:41 486
原创 Extended Eucild's algorithm
算法要求: Given two positive integers m and n, we compute their greatest common divisor d,and we also compute two not-necessarily-positive integers a and b such that am + bn = d. 对于给定的两个正整数 m 和 n,我们能得
2016-03-05 21:48:46 483
原创 Euclid‘s algorithm
这算是TAOCP的读书笔记吧,这次写的主要是卷一的Euclid‘s algorithm。 以下是一些书上的摘录和C语言代码的实现: 算法要求: Give two positive integers m and n, find their greatest common divisor,that is,the largest positive integer that evenly d
2016-03-01 22:42:19 1025
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人