Close
Close window
LongestCommonSubSequence - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Mozilla Firefox.
Maplesoft logo
Maplesoft logo

Online Help

All Products Maple MapleSim


[フレーム] [フレーム]

StringTools

LongestCommonSubString

return the longest common substring of two strings

LongestCommonSubSequence

return the longest common subsequence of two strings

Calling Sequence

LongestCommonSubString( s1, s2 )

LongestCommonSubSequence( s1, s2 )

Parameters

s1

-

Maple string

s2

-

Maple string

Description

A substring of a string S is a contiguous sequence of the characters appearing in S. The empty string is a substring of every string. A subsequence of a string S is a sequence of characters from S, which may not be contiguous in S. Every substring of S is a subsequence of S. For example, bc is a substring of abc, and ac is a subsequence of abc which is not a substring.

The LongestCommonSubString( s1, s2 ) command returns from its input strings, s1 and s2, a common substring of maximum length.

Many common substrings of maximum length may exist. Which among the candidates is returned depends upon the suffix structure of the pair of strings, but is deterministic.

The LongestCommonSubSequence( s1, s2 ) command is similar, but searches for subsequences of the pair of input strings rather than substrings.

All of the StringTools package commands treat strings as (null-terminated) sequences of 8-bit (ASCII) characters. Thus, there is no support for multibyte character encodings, such as unicode encodings.

Examples

>

useStringToolsinLongestCommonSubStringabax,baxend use

bax

(1)
>

withStringTools:

>

LongestCommonSubStringtsaxbaxyz,axcaxy

axy

(2)
>

LongestCommonSubStringabcde,uvabxycde

cde

(3)
>

LongestCommonSubSequenceabcde,uvabxycde

abcde

(4)
>

LongestCommonSubStringabc,xyz

(5)
>

LongestCommonSubSequenceabc,xyz

(6)
>

seq1TAAGGTCGGCGCGCACGCTGGCGAGTATGGTGCGGAGGCCCTGGAGAGGTGAGGCTCCCTCCCCTGCTCCGACCCGGGCTCCTCGCCCGCCCGGACCCAC:

>

seq2AAGCGCCGCGCAGTCTGGGCTCCGCACACTTCTGGTCCAGTCCGACTGAGAAGGAACCACCATGGTGCTGTCTCCCGCTGACAAGACCAACATCAAGACTGCCTGGGAAAAGATCGGCAGCCACGGTGGCGAGTATGGCGCCGAGGCCGT:

>

LongestCommonSubStringseq1,seq2

TGGCGAGTATGG

(7)
>

LongestCommonSubSequenceseq1,seq2

AAGGCCGCGCAGCTGGCGATTGGTCAGCCCTGGAAGGTGGGCTCTCCCCTGCTCGACCCGGGTCCGCCCGCGGACCCA

(8)


Download Help Document

AltStyle によって変換されたページ (->オリジナル) /