![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Introduction to Algorithms
文章平均质量分 78
亚尔诺炽焰
这个作者很懒,什么都没留下…
展开
-
[算法导论] 快速排序
package quicksort;public class Solution { public static void main(String[] args) { QuickSort quickSort = new QuickSort(); int[] datas = new int[]{5, 6, 8, 1, 3, 10, 8, 5, 4, 15, 11}; quick原创 2016-05-02 22:54:32 · 433 阅读 · 0 评论 -
[算法导论] BF算法与KMP算法
#include #include using namespace std;int Index_BF(char *s,char *t)//从串s的第一个字符开始找首次与串t相等的子串 { int i=1,j=1; while((i<=s[0])&&(j<=t[0])) { if(s[i]==t[j]) { i++; j++; } el原创 2014-11-22 19:26:00 · 542 阅读 · 0 评论 -
KMP算法及优化
1. KMP算法1.1 定义 Knuth-Morris-Pratt 字符串查找算法,简称为 “KMP算法”,常用于在一个文本串S内查找一个模式串P 的出现位置,这个算法由Donald Knuth、Vaughan Pratt、James H. Morris三人于1977年联合发表,故取这3人的姓氏命名此算法。 下面先直接给出KMP的算法流程(如果感到一点点不适,没关系,坚持下转载 2018-02-01 17:47:16 · 471 阅读 · 0 评论