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 中的元素都属于有限的字 ...
随机推荐
- windows下的文件到linux下乱码 iconv 修改文件编码
conv [选项...] [文件...] 有如下选项可用: 输入/输出格式规范:-f, --from-code=名称 原始文本编码-t, --to-code=名称 输出编码 信息:-l, --list ...
- Android 返回桌面的Intent
Intent MyIntent = new Intent(Intent.ACTION_MAIN); MyIntent.addCategory(Intent.CATEGORY_HOME); startA ...
- Java面向对象的继承
继承也是面向对象的又一重要特性,继承是类于类的一种关系,通俗来说狗属于动物类,那么狗这个类就继承了动物类 java中的继承是单继承的,一个类只能继承与一个父类 子类继承父类之后,子类就拥有了父类的所有 ...
- ECSHOP修改后台地址
为了保证ECSHOP商城安全,需要修改许多默认的程序路径,今天讲下后台路径修改. ECSHOP修改后台路径根据版本不同,修改的地方也不一样.我现在用的是2.7.3,上网查了资料,很少,所以自己先写下来 ...
- codeforces 467C.George and Job 解题报告
题目链接:http://codeforces.com/problemset/problem/467/C 题目意思:给出一条含有 n 个数的序列,需要从中找出 k 对,每对长度为 m 的子序列,使得 找 ...
- 手把手教你学会 Emacs 定制
Table of Contents 1 前言 2 配置Emacs 2.1 设置界面 2.2 全屏以及最大化 2.3 设置周边 2.4 显示时间设置 2.5 设置日历 2.6 设置符合个人的操作习惯 2 ...
- Mac 安装Java JDK
(一)Java JDK 首先到该网址,下载JavaSE http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads- ...
- dfs常见的配置文件中的value与description
照抄于网络: name value description dfs.namenode.logging.level info The logging level for dfs namenode. Ot ...
- loj 1031(区间dp+记忆化搜索)
题目链接:http://lightoj.com/volume_showproblem.php?problem=1031 思路:dp[i][j]表示从区间i-j中能取得的最大值,然后就是枚举分割点了. ...
- loj 1154(最大流+枚举汇点)
题目链接:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=26868 思路:拆点,容量为最多能跳的步数,然后设立一个超级源点,源 ...