Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > Core Language > String Manipulation > Sequence Alignment & Comparison > LongestCommonSequence >

LongestCommonSequence

LongestCommonSequence
finds the longest sequence of contiguous or disjoint elements common to the strings or lists and .
  • If there are several common subsequences of the same length, LongestCommonSequence returns the one that begins earliest in .
  • For strings, setting the option IgnoreCase->True makes LongestCommonSequence treat lowercase and uppercase letters as equivalent, and return the form of common sequence that occurs in .
Find the longest noncontiguous sequence common to two strings:
Find the longest noncontiguous sequence common to two strings:
In[1]:=
Click for copyable input
Out[1]=
Find the lengths of longest common sequences in random binary sequences of length 1000:
New in 7
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team
Format:   HTML  |  CDF