1 Star 0 Fork 0

wingrez / string-match

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
main.cpp 947 Bytes
一键复制 编辑 原始数据 按行查看 历史
wingrez 提交于 2021-08-16 13:47 . update
#include "timer.h"
#include "BF.h"
#include "RK.h"
#include "KMP.h"
#include "Sunday.h"
#include <iostream>
#include <string>
#include "assert.h"
using namespace std;
using namespace wingrez;
void test_001()
{
string S = "hello world!";
string T = "world";
int res;
Timer::reset();
res = BF(S, T, 0);
assert(res == 6);
cout << "B: " << Timer::getSpanTime<unit::ms>() << endl;
res = RK(S, T, 0);
assert(res == 6);
cout << "R: " << Timer::getSpanTime<unit::ms>() << endl;
getNext(T);
res = KMP(S, T, 0);
assert(res == 6);
cout << "K: " << Timer::getSpanTime<unit::ms>() << endl;
getNextOpt(T);
res = KMP(S, T, 0);
assert(res == 6);
cout << "K: " << Timer::getSpanTime<unit::ms>() << endl;
res = Sunday(S, T, 0);
assert(res == 6);
cout << "S: " << Timer::getSpanTime<unit::ms>() << endl;
}
int main(int argc, char *argv[]) {
test_001();
return 0;
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wingrez/string-match.git
git@gitee.com:wingrez/string-match.git
wingrez
string-match
string-match
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891