TheAlgorithms/C++ 1.0.0
All the algorithms implemented in C++
|
The Knuth-Morris-Pratt Algorithm for finding a pattern within a piece of text with complexity O(n + m) More...
#include <cassert>
#include <iostream>
#include <string>
#include <vector>
Go to the source code of this file.
Namespaces | |
namespace | string_search |
String search algorithms. | |
Functions | |
std::vector< size_t > | string_search::getFailureArray (const std::string &pattern) |
Generate the partial match table aka failure function for a pattern to search. | |
size_t | string_search::kmp (const std::string &pattern, const std::string &text) |
KMP algorithm to find a pattern in a text. | |
static void | tests () |
self-test implementations | |
int | main () |
The Knuth-Morris-Pratt Algorithm for finding a pattern within a piece of text with complexity O(n + m)
Definition in file knuth_morris_pratt.cpp.
int main | ( | void | ) |
Definition at line 95 of file knuth_morris_pratt.cpp.
|
static |
self-test implementations
Definition at line 79 of file knuth_morris_pratt.cpp.