《算法》复习总结(张聪).docVIP

  • 3
  • 0
  • 约6.3千字
  • 约 6页
  • 2016-04-29 发布于浙江
  • 举报
全书共10章,从基本的数字算法人手,先后介绍了分治、图的遍历、贪心算法、动态规划、线性规划等技术,对NP完全问题进行厂基本而清晰的阐述,对随机算法、近似算法和量子算法这些近年来发展迅猛的领域也花费了一定的笔墨。…n] f[0]=0,f[1]=1 for i=2…n; f[i]=f[i-1]+f[i-2] return f[n] 大O符号:令f(n)和g(n)均为从正整数到正实数的函数,如果存在一个常数c0,使得f(n)=c·g(n)成立,则f=O(g) 模运算: 替代准则:如果x≡x`(mod N)和y≡y`(mod N),则x+y≡x`+y`(mod N)和xy≡x`y`(mod N) 模的指数运算: function modexp(x; y; N ) Input: Two n-bit integers x and N , an integer exponent y Output: x^ymod N if y = 0: return 1 z = modexp(x; by=2c; N ) if y is even: return z^2mod N else: return x  z^2mod N Euclid最大公因数算法: 规则:如果x,y是正整数,且x=y,那么gcd(x,y)=gcd(x mod y,y) function Euclid(a; b) Input: Two i

文档评论(0)

1亿VIP精品文档

相关文档