全部书籍

专业

应用 关于 Coach 登录 开始阅读

书籍暂未推出简体中文版——当前显示英文版。

Computer Science · 术语表

什么是 Rolling hash, spurious hit?

又称: rolling hash · spurious hit

Definition 25.10 University Computer Science — Year 2 · 第 25 章 — Text Algorithms and Compression

The rolling hash of a window T[s..s+m−1]T[s..s+m-1] is hs=∑j=0m−1T[s+j] 256m−1−j mod qh_s = \sum_{j=0}^{m-1} T[s + j]\, 256^{m-1-j} \bmod q. It satisfies hs+1=((hs−T[s]⋅256m−1)⋅256+T[s+m]) mod qh_{s+1} = ((h_s - T[s] \cdot 256^{m-1}) \cdot 256 + T[s + m]) \bmod q. A shift whose hash equals the pattern’s, hs=h(P)h_s = h(P), but which is not an occurrence, is a spurious hit.

在原文中阅读 →