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 中的元素都属于有限的字 ...
随机推荐
- [Effective JavaScript 笔记]第28条:不要信赖函数对象的toString方法
js函数有一个非凡的特性,即将其源代码重现为字符串的能力. (function(x){ return x+1 }).toString();//"function (x){ return x+ ...
- Unity3d与iOS交互开发——接入平台SDK必备技能
原地址:http://www.2cto.com/kf/201401/273337.html# 前言废话:开发手机游戏都知道,你要接入各种平台的SDK.那就需要Unity3d与iOS中Objective ...
- 秀尔算法:破解RSA加密的“不灭神话”
RSA加密 VS 秀尔算法 作为RSA加密技术的终结者——“太多运算,无法读取”的秀尔算法(Shor’s algorithm)不是通过暴力破解的方式找到最终密码的,而是利用量子计算的并行性,可以快速分 ...
- AMD64与IA64的区别
其实很多人从字面上,都以为AMD64就是针对AMD CPU的,IA64是针对INTEL CPU,其实是错的,我最初也是这样认为,其实不然: 你在市面上买的到的intel 64位 CPU都属于amd64 ...
- Linux MySQL 存储引擎详解
MySQL常用的存储引擎为MyISAM.InnoDB.MEMORY.MERGE,其中InnoDB提供事务安全表,其他存储引擎都是非事务安全表. MyISAM是MySQL的默认存储引擎.MyISAM不支 ...
- load url from future 解释
利用url 标签之后,不管urlpatterns里的某个地址叫法怎么改变,Templates里的地址都不用修改了.在模版中调用url标签的时候,需要:{% load url from future % ...
- tcp ip detatils
tcp ip detatils 8.关于TCP协议,下面哪种说法是错误的()A.TCP关闭连接过程中,两端的socket都会经过TIME_WAIT状态B.对一个Established状态的TCP连接, ...
- MySQL 全文搜索支持, mysql 5.6.4支持Innodb的全文检索和类memcache的nosql支持
背景:搞个个人博客的全文搜索得用like啥的,现在mysql版本号已经大于5.6.4了也就支持了innodb的全文搜索了,刚查了下目前版本号都到MySQL Community Server 5.6.1 ...
- Java for LeetCode 077 Combinations
Given two integers n and k, return all possible combinations of k numbers out of 1 ... n. For exampl ...
- Java for LeetCode 062 Unique Paths
A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The ...