我試圖在f#中實現Cyclic polynomial hash function。它使用按位運算符^^^和< < <。這裏是一個散列的數組的函數的例子: let createBuzhash (pattern : array<'a>) =
let n = pattern.Length
let rec loop index pow acc =
if index < n then
我有問題實施Karp-Rabin模式marcher的天真版本;我沒有得到預期的結果。這是我的例子; string='today is a good day'
sub='good'
我想在上面的字符串中找到好的模式。 def kapr(n,m):
for i in range(len(n)-len(m)+1):
for j in range(len(m)):
我在使用Karp-Rabin(無散列)進行多模式搜索時遇到了麻煩。這是我的例子: _string="today is a good day"
_patterns=['good', 'day']
def multiple_pattern_search(string,substrings,size):
stringsize=string[:size]
for i in ra
我已經使用以下字母表生成了一個字符串。 {A,C,G,T}。而我的字符串包含超過10000個字符。我正在尋找下面的模式。 ATGGA TGGAC CCGT 我已要求使用字符串匹配算法具有O(m+n)運行時間。 m = pattern length
n = text length
KMP and Rabin-Karp algorithms都有這個運行時間。在這種情況下什麼是最合適的算法(在Ra