kmp 和boyer-moore
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>Visualizing String Matching Algorithms</title> <script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script src="javascript/strmatch.js"></script> <link href="//netdna.bootstrapcdn.com/bootstrap/3.0.1/css/bootstrap.min.css" rel="stylesheet">
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.1/js/bootstrap.min.js"></script> <script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-45824317-1', 'whocouldthat.be');
ga('send', 'pageview');
</script> <style>
.monospace {
font-family: courier new;
font-size: 30px;
padding-bottom:20px;
min-width: 30px;
} .cell {
text-align: center;
} .options {
padding-top: 20px;
} #needle {
position:absolute;
} #haystack {
} .table-cell {
text-align: center;
width: 40px;
} .char-table {
table-layout: fixed;
} #links {
position:absolute;
bottom:0;
}
</style> </head>
<body> <a href="https://github.com/justinj/string-matching-visualization"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub"></a>
<div id="main" class="container">
<form class="form-inline">
<div class="options"> <div class="algorithms form-group">
<div class="radio">
<label>
<input type="radio" name="algorithm" class="algbutton input" value="naive" checked="true"></radio>
Naïve
</label>
</div>
<div class="radio">
<label>
<input type="radio" name="algorithm" class="algbutton" value="kmp"></radio>
KMP
</label>
</div>
<div class="radio">
<label>
<input type="radio" name="algorithm" class="algbutton" value="boyer_moore"></radio>
Boyer-Moore
</label>
</div>
<br><label>Algorithm</label>
</div> <div class="form-group">
<label>
<input type="text" value="ABCDABD" maxlength="10" id="needle-input" class="form-control"></input> Needle
</label>
</div>
<div class="form-group">
<label>
<input type="text" value="ABC ABCDAB ABCDABCDABDE" maxlength="30" id="haystack-input" class="form-control"></input> Haystack
</label>
</div>
<br>
<input type="button" value="Animate" class="btn btn-default" id="animate"></input>
<input type="button" value="Step" class="btn btn-default" id="step"></input>
<input type="button" value="Reset" class="btn btn-default" id="reset"></input>
</div>
</form> <div class="result">
<div id="haystack" class="monospace"></div></br>
<div id="needle" class="monospace"></div>
</div>
<br><br><br><br>
<div class="row">
<div id="tables" class="col-sm-4"></div>
<div id="explanation" class="col-sm-4"></div>
</div>
<div class="row">
<div id="links">
<a href="http://en.wikipedia.org/wiki/String_matching">Wikipedia Article on String Matching</a><br>
<a href="http://en.wikipedia.org/wiki/Knuth%E2%80%93Morris%E2%80%93Pratt_algorithm">KMP Algorithm</a><br>
<a href="http://en.wikipedia.org/wiki/Boyer%E2%80%93Moore_string_search_algorithm">Boyer-Moore Algorithm</a><br>
</div>
</div>
</div> </div>
</body>
</html>
kmp 和boyer-moore的更多相关文章
- Boyer–Moore (BM)字符串搜索算法
在计算机科学里,Boyer-Moore字符串搜索算法是一种非常高效的字符串搜索算法.它由Bob Boyer和J Strother Moore设计于1977年.此算法仅对搜索目标字符串(关键字)进行预处 ...
- Boyer Moore算法(字符串匹配)
上一篇文章,我介绍了KMP算法. 但是,它并不是效率最高的算法,实际采用并不多.各种文本编辑器的"查找"功能(Ctrl+F),大多采用Boyer-Moore算法. Boyer-Mo ...
- Leetcode OJ : Implement strStr() [ Boyer–Moore string search algorithm ] python solution
class Solution { public: int strStr(char *haystack, char *needle) { , skip[]; char *str = haystack, ...
- 字符串问题简述与两个基本问题的Java实现——判断二叉树拓扑结构关系与变形词
转载请注明原文地址:http://www.cnblogs.com/ygj0930/p/6851631.html (解题金句:其他问题字符串化,然后调用String类封装方法解决问题: 字符串问题数组 ...
- grep之字符串搜索算法Boyer-Moore由浅入深(比KMP快3-5倍)
这篇长文历时近两天终于完成了,前两天帮网站翻译一篇文章“为什么GNU grep如此之快?”,里面提及到grep速度快的一个重要原因是使用了Boyer-Moore算法作为字符串搜索算法,兴趣之下就想了解 ...
- grep之字符串搜索算法Boyer-Moore由浅入深(比KMP快3-5倍)(转)
这篇长文历时近两天终于完成了,前两天帮网站翻译一篇文章“为什么GNU grep如此之快?”,里面提及到grep速度快的一个重要原因是使用了Boyer-Moore算法作为字符串搜索算法,兴趣之下就想了解 ...
- KMP算法简单回顾
前言 虽从事企业应用的设计与开发,闲暇之时,还是偶尔涉猎数学和算法的东西,本篇根据个人角度来写一点关于KMP串匹配的东西,一方面向伟人致敬,另一方面也是练练手,头脑风暴.我在自娱自乐,路过的朋友别太认 ...
- 字符串匹配常见算法(BF,RK,KMP,BM,Sunday)
今日了解了一下字符串匹配的各种方法. 并对sundaysearch算法实现并且单元. 字符串匹配算法,是在实际工程中经常遇到的问题,也是各大公司笔试面试的常考题目.此算法通常输入为原字符串(strin ...
- Majority Element问题---Moore's voting算法
Leetcode上面有这么一道难度为easy的算法题:找出一个长度为n的数组中,重复次数超过一半的数,假设这样的数一定存在.O(n2)和O(nlog(n))(二叉树插入)的算法比较直观.Boyer–M ...
- Boyer-Moore 字符串匹配算法
字符串匹配问题的形式定义: 文本(Text)是一个长度为 n 的数组 T[1..n]: 模式(Pattern)是一个长度为 m 且 m≤n 的数组 P[1..m]: T 和 P 中的元素都属于有限的字 ...
随机推荐
- 重构edit 和 new页面
www.iwangzheng.com 由于edit和new页面的相似部分很多,需要提取出来,现在就是提取的方法 从form 的开始部分选中,shift+v选中对应的行 :Rextract form 然 ...
- [POJ1338]Ugly Numbers
[POJ1338]Ugly Numbers 试题描述 Ugly numbers are numbers whose only prime factors are 2, 3 or 5. The sequ ...
- HDU 1875 畅通工程再续 (prim最小生成树)
B - 畅通工程再续 Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit S ...
- 用nginx做反向代理来访问防外链图片
用nginx做反向代理来访问防外链图片 女儿的博客从新浪搬到wordpress后,发现原来博客上链接的新浪相册的图片都不能访问了,一年的博客内容,一个个去重新上传图片,修正链接也是个大工程.还是得先想 ...
- ubuntu apt-get update 失败解决
在执行 sudo apt-get update 之后 会出现如下错误 这是要检测网络是否有问题 因为我之前只使用nfs挂载的时候,在虚拟机 编辑-> 虚拟网络编辑器里面->更改设置里面 ...
- (转)maven eclipse debug
准备工作: a. 在pom.xml中配置jetty插件: <plugins> <plugin> <groupId>org.mortbay.jetty</gro ...
- iOS CoreData学习资料 和 问题
这里是另一篇好文章 http://blog.csdn.net/kesalin/article/details/6739319 这里是另一篇 http://hxsdit.com/1622 (不一定能访问 ...
- PHP+redis实现超迷你全文检索
2014年10月31日 11:45:39 情景: 我们平台有好多游戏, 运营的同事在查询某一款游戏的时候, 目前使用的是html的select下拉列表的展现形式, 运营的同事得一个个去找,然后选中,耗 ...
- 利用FFmpeg生成视频缩略图 2.1.8
1.下载FFmpeg文件包,解压包里的\bin\下的文件解压到 D:\ffmpeg\ 目录下. 下载地址 http://ffmpeg.zeranoe.com/builds/win32/static/ ...
- 【USACO】namenum
//开始傻×了 受题目形容的误导 一心想生成所有可能的 字符串组合 之后查找非常慢 //听了同学的 将5000个dict里的字符串 转换成char型数组(不能直接用int 会越界)直接用输入的数据对着 ...