Click or drag to resize
LongestCommonSubstring Class

The LongestCommonSubstring class provides a client for computing the longest common substring that appears in two given strings.

This implementation computes the suffix array of each string and applies a merging operation to determine the longest common substring. For an alternate implementation, see LongestCommonSubstringConcatenate.java.

Inheritance Hierarchy
SystemObject
  Algs4NetLongestCommonSubstring

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

The LongestCommonSubstring type exposes the following members.

Methods
  NameDescription
Public methodStatic memberLcs
Returns the longest common string of the two specified strings.
Public methodStatic memberMainTest
Demo test the Lcs() client. Reads in two strings from files specified as command-line arguments; computes the longest common substring; and prints the results to standard output.
Top
Remarks

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

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

See Also