Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
kmp_example.cc File Reference

Illustrative example for KMP pattern matching. More...

#include <iostream>
#include <string>
#include <String_Search.H>
Include dependency graph for kmp_example.cc:

Go to the source code of this file.

Functions

int main ()
 Example program demonstrating KMP prefix computation and pattern search.
 

Detailed Description

Illustrative example for KMP pattern matching.

Definition in file kmp_example.cc.

Function Documentation

◆ main()

int main ( )

Example program demonstrating KMP prefix computation and pattern search.

Computes the prefix function for a hard-coded pattern, finds all occurrences of that pattern in a hard-coded text using the library's KMP routines, and prints the text, pattern, prefix function values, and match positions to standard output.

Returns
int 0 on successful termination.

Definition at line 54 of file kmp_example.cc.

References Aleph::divide_and_conquer_partition_dp(), Aleph::kmp_prefix_function(), and Aleph::kmp_search().