Rabin-karp算法中的模块化算法

时间:2017-10-27 19:34:26

标签: string-matching modular-arithmetic clrs rabin-karp

enter image description here

我正在研究从CLRS进行字符串匹配的Rabin-karp算法,其中模块化算法用于哈希,我没有研究过,所以我不明白的是(7 - 3·3)·10 + 2(mod 13)评估为8(mod 13)

1 个答案:

答案 0 :(得分:0)

(7 – 3·3)·10 + 2(mod 13)评估为8(mod 13)

因为7-9 = 11,而不是-2。