Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class SundaySearch2:public StringSearch
- {
- public:
- SundaySearch2(string T,string W):StringSearch(T,W) {}
- int Oracle[256];
- void search()
- {
- for(int i=0; i<256; i++)
- {
- Oracle[i]=W.size()+1;
- }
- for(int i=0; i<static_cast<int>(W.size()); i++)
- {
- Oracle[static_cast<int>(W[i])]=static_cast<int>(W.size())-i;
- }
- int i=0;
- while(i<=static_cast<int>(T.size())-static_cast<int>(W.size()))
- {
- if(matches_at(i))
- {
- cout <<"OD miejsca "<<i<<endl;
- v.push_back(i);
- }
- if(i+W.size()>=T.size())
- break;
- {
- i+=Oracle[static_cast<int>(T[i+W.size()])];
- // i+=Oracle[static_cast<int>(T[1+W.size()])];
- }
- }
- }
- const vector<int>&getoccurences()
- {
- return v;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement