?? kmpsearch.h
字號(hào):
#ifndef KMPSEARCH_H__
#define KMPSEARCH_H__
#include <string>
#include "Vector.h"
using namespace std;
/* 利用KMP算法在主串str中從pos開始搜索模式ptn,
* 若找到返回第一次出現(xiàn)的位置, 否則返回str.size()
*/
int KmpSearch(const string& str, const string& ptn, int pos = 0);
/* 利用KMP算法在主串str中搜索所有模式ptn, (允許重疊)
* 返回找到的下標(biāo)的數(shù)組
*/
Vector<int> KmpSearchAll(const string& str, const string& ptn);
/* 利用KMP算法在主串str中搜索所有模式ptn, (不允許重疊)
* 返回找到的下標(biāo)的數(shù)組
*/
Vector<int> KmpSearchAllNoOverlap(const string& str, const string& ptn);
#endif // KMPSEARCH_H__
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -