如何编写java中的rabin karp字符串匹配算法 [英] How to code for rabin karp string matching algorithm in java

查看:65
本文介绍了如何编写java中的rabin karp字符串匹配算法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用十进制数字在许多网站上解释了rabin karp算法。但是如果我想使用文本(即字母表)实现相同的算法,我该怎么做?

相同的程序不是apply.hence我如何使用rabin karp在字符串匹配中处理文本?



我尝试了什么:



i已尝试过数字,但是对于文本我无法编码它虽然我找到了它的逻辑。

The rabin karp algorithm is explained in many websites using decimal numbers.But if i want to implement the same algorithm using text(i.e.,alphabets) how do i do it?
the same procedure isnt applicable.hence how do i work for text in string matching using rabin karp ?

What I have tried:

i have tried for numbers but for text am not able to code it though i found the logic of it.

推荐答案

参见< a href =https://en.wikipedia.org/wiki/Rabin%E2%80%93Karp_algorithm> Rabin-Karp算法 - 维基百科,免费的百科全书 [ ^ ]。


这篇关于如何编写java中的rabin karp字符串匹配算法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆