55 const std::string text =
"needle in a haystack with another needle";
56 const std::string pattern =
"needle";
60 std::cout <<
"Boyer-Moore-Horspool Example\n";
61 std::cout <<
"Text : " << text <<
"\n";
62 std::cout <<
"Pattern: " << pattern <<
"\n\n";
64 std::cout <<
"Matches at positions: ";
65 if (matches.is_empty())
68 for (
size_t i = 0; i < matches.size(); ++i)
69 std::cout << matches[i] << (i + 1 == matches.size() ?
"" :
" ");
Classical pattern searching algorithms over strings.
int main()
Demonstrates usage of the Boyer–Moore–Horspool string search.
Main namespace for Aleph-w library functions.
Array< size_t > boyer_moore_horspool_search(const std::string_view text, const std::string_view pattern)
Find all occurrences using Boyer-Moore-Horspool.