-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmian.cpp
More file actions
54 lines (43 loc) · 919 Bytes
/
Copy pathmian.cpp
File metadata and controls
54 lines (43 loc) · 919 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
*功能:串的所有执行策测试
*时间:2015年7月15日17:16:01,2015年7月21日20:33:10,2015年7月26日16:37:31
*文件:SString.h
*作者:cutter_point
*/
#include <iostream>
#include "kmp.h"
#include "SString.h"
using namespace std;
int main()
{
unsigned char c[] = " acabaabaabcacaabc";
unsigned char c2[] = " abaabcac";
SString T;
T.setCh(c2);
T.setLength(8);
KmpString *ks = new KmpString(c, 16);
ks->get_next(T);
int *p = ks->getNext();
for (int i = 0; i < 9; ++i)
{
cout << *(p + i) << "\t";
}
cout << endl;
cout <<"我们的子串在主串中起始的位置:"<< ks->index_KMP(T, 1) << endl;
return 0;
}
/*
int main()
{
unsigned char ch[] = {' ', 'a','b','a','b','c','a','b','c','a','c','b','a','b'};
unsigned char ch2[] = {' ', 'a','b','c'};
int lengch = 14;
int lengch2 = 3;
SString *s = new SString(ch, lengch);
SString t;
t.setCh(ch2);
t.setLength(lengch2);
cout<<s->BFindex(t, 1);
return 0;
}
*/