检索规则说明:AND代表“并且”;OR代表“或者”;NOT代表“不包含”;(注意必须大写,运算符两边需空一格)
检 索 范 例 :范例一: (K=图书馆学 OR K=情报学) AND A=范并思 范例二:J=计算机应用与软件 AND (U=C++ OR U=Basic) NOT M=Visual
机构地区:[1]哈尔滨工业大学计算机科学与技术学院,哈尔滨150001 [2]对外经济贸易大学保险学院,北京100029
出 处:《智能计算机与应用》2018年第1期116-122,共7页Intelligent Computer and Applications
摘 要:Karp-Rabin算法是利用hash函数的特性进行字符串匹配的算法。KR算法对模式串和循环中每一次要匹配的子串按一定的hash函数求值,如果hash值相同,才进一步比较这2个串是否真正相等。Karp-Rabin算法适用于多个字符串匹配。该算法所需要的空间存储很小,相比AC算法在空间占用上具有很大的优势。本文首先将模式串进行合适的分类,求出模式串半段对应的哈希值,然后对目标段按照模式串的基准长度进行分段,每次比较目标段是否含有模式串的半段,若含有,则继续比较;否则,继续进行下一个目标段的匹配。最后通过实验验证,证明了算法的有效性。Karp-Rabin algorithm is a string matching algorithm using the characteristics of hash functions. The KR algorithmevaluates each substring of the pattern string and the loop in accordance with a certain hash function. If the hash value is the same,then the two strings are compared to determine they are equal or unequal. Karp -Rabin algorithm is suitable for multiple stringmatching better. The space storage required by the algorithm is very small, and it has great advantages in space occupation comparedwith AC algorithm. This paper first classifies the pattern string properly. The hash value corresponding to the half segment of thepattern string is computed. Then, the target segment is segmented according to the reference length of the pattern string. Each timedetermines whether the target segment contains half of the string of patterns. If it contains, continue to compare; otherwise, continuethe matching of the next target segment. Finally, the validity of the algorithm is proved by experiments.
分 类 号:TP301[自动化与计算机技术—计算机系统结构]
正在载入数据...
正在载入数据...
正在载入数据...
正在载入数据...
正在载入数据...
正在载入数据...
正在载入数据...
正在链接到云南高校图书馆文献保障联盟下载...
云南高校图书馆联盟文献共享服务平台 版权所有©
您的IP:216.73.216.7