
算法
daweibalong
这个作者很懒,什么都没留下…
展开
-
后缀数组的python模拟--编程珠玑 15.2
今天看了编程珠玑第15章字符串的前两节,对于后缀数组这玩意很感兴趣(以前学的太少了),对于15.2节的求给定文本输入的最长重复子串的问题,顺着作者的思路和其网站( http://netlib.bell-labs.com/cm/cs/pearls/index.html )上的代码,用c语言实现了一下,网站上代码如下:#include <stdlib.h>#include ...2012-08-24 10:11:04 · 229 阅读 · 0 评论 -
随机算法--Las Vegas--大数因子分解--Pollard Rho启发式算法(c++版)
随机算法里的大数因子分解(Pollard Rho启发式算法),vc++6.0中实现,写的时候测的数比较小,只用了int,懒得改了,再用的时候再改成更大的数据类型:001 #include<iostream>002 #include<vector>003 #include<algorithm>004 #include<cmath&g...2012-08-24 10:15:49 · 410 阅读 · 0 评论 -
随机算法--Las Vegas算法--大数因子分解--Pollard Rho启发式算法(python版)
'''Created on 2012-3-10@author: daweibalong'''from random import randintf=[]def gcd(m,n): if n>0: return gcd(n,m%n) return mdef isPrime(n): if n...2012-08-24 10:23:18 · 837 阅读 · 0 评论