![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
字符串操作
文章平均质量分 74
cjliux
这个作者很懒,什么都没留下…
展开
-
C++实现KMP模式匹配算法
#include #include #include using namespace std; void Next(const string & pat,vector & next) { next.resize(pat.length()); if(pat.length() == 0) return; next[0] = -1; for(size_t pos = 1; pos原创 2015-08-20 23:22:52 · 1005 阅读 · 0 评论 -
C++实现KMP算法(C风格)
/* * Main.cpp * * Created on: Oct 7, 2015 * Author: chris */ #include #include using namespace std; bool get_next(const char* pat, int*& next) { int len = strlen(pat); next = new int[原创 2015-10-07 17:05:52 · 371 阅读 · 0 评论 -
C++实现KMP算法(单值返回版)
/* * Main.cpp * * Created on: Oct 7, 2015 * Author: chris */ #include #include using namespace std; bool get_next(const char* pat, int*& next) { int len = strlen(pat); next = new int[原创 2015-10-07 17:26:58 · 431 阅读 · 0 评论 -
C++实现KMP算法(修正版,C++风格)
/* * Main.cpp * * Created on: Oct 7, 2015 * Author: chris */ #include #include #include using namespace std; void get_next(const string pat, vector& next) { next.resize(pat.length(), 0原创 2015-10-07 17:54:36 · 434 阅读 · 0 评论 -
C++实现KMP算法(优化版)
/* * Main.cpp * * Created on: Oct 7, 2015 * Author: chris */ #include #include #include using namespace std; void get_next(const string pat, vector& next) { next.resize(pat.length(), 0原创 2015-10-07 18:15:09 · 399 阅读 · 0 评论 -
C++实现串的最小操作子集
/* * HString.h * * Created on: Oct 7, 2015 * Author: chris */ #ifndef HSTRING_H_ #define HSTRING_H_ #include struct HString{ int length; char *ch; HString(): length(0), ch(NULL) {} }原创 2015-10-07 15:58:22 · 1012 阅读 · 0 评论 -
编译原理之标识符拆分
#pragma once #include #include #include using namespace std; const unordered_set keywords({ "auto", "short", "int", "long", "float", "double", "char", "struct", "union", "enum", "typedef", "const原创 2016-10-08 21:06:31 · 2165 阅读 · 0 评论