Boyer - Moore string search into Sunday string search (quick string search) c++ -


i want turn boyer - moore algorithm sunday (quick search). have working version of boyer - moore string search algorithm:

vector <int> table(256); fill(table.begin(), table.end(), -1);  (int = 0; < target_size; i++) {     table[(int)target[i]] = i; }  int s = 0; while (s <= (text_size - target_size)) {     int j = target_size - 1;     while (j >= 0 && target[j] == text[s + j])          j--;      if (j < 0) {         cout << s << endl;         s += (s + target_size < text_size) ? text_size- table[text[s + target_size]] : 1;     }     else         s += max(1, j - table[text[s + target_size]]); } 

i have been looking @ following 2 links explain sunday (quick search) algorithm, not sure how change b-m sunday:

http://www.iti.fh-flensburg.de/lang/algorithmen/pattern/sundayen.htm

http://www-igm.univ-mlv.fr/~lecroq/string/node19.html

i appreciate tips.


Comments