Click or drag to resize
RabinKarp Class
The RabinKarp class finds the first occurrence of a pattern string in a text string. This implementation uses the Rabin-Karp algorithm.
Inheritance Hierarchy
SystemObject
  Algs4NetRabinKarp

Namespace: Algs4Net
Assembly: Algs4Net (in Algs4Net.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
C#
public class RabinKarp

The RabinKarp type exposes the following members.

Constructors
  NameDescription
Public methodRabinKarp
Preprocesses the pattern string.
Top
Methods
  NameDescription
Public methodStatic memberMainTest
Takes a pattern string and an input string as command-line arguments; searches for the pattern string in the text string; and prints the first occurrence of the pattern string in the text string.
Public methodSearch
Returns the index of the first occurrrence of the pattern string in the text string.
Top
Remarks

For additional documentation, see Section 5.3 of Algorithms, 4th Edition by Robert Sedgewick and Kevin Wayne.

This class is a C# port from the original Java class RabinKarp implementation by the respective authors.

See Also