Substring

Substring

A subsequence, substring, prefix or suffix of a string is a subset of the symbols in a string, where the order of the elements is preserved. In this context, the terms "string" and "sequence" have the same meaning.

Subsequence

:"Main article subsequence"

A subsequence of a string T = t_1 t_2 dots t_n is a string hat T = t_{i_1} dots t_{i_m} such that i_1 < dots < i_m, where m leq n. Subsequence is a generalisation of substring, suffix and prefix. Finding the longest string which is equal to a subsequence of two or more strings is known as the longest common subsequence problem.

Example: The string anna is equal to a subsequence of the string banana:

banana
| |
an na

Substring

A substring (or factor) of a string T = t_1 dots t_n is a string hat T = t_{1+i} dots t_{m+i}, where 0 leq i and m + i leq n. A substring of a string is a prefix of a suffix of the string, and equivalently a suffix of a prefix. If hat T is a substring of T, it is also a subsequence, which is a more general concept. Given a pattern P, you can find its occurrences in a string T with a string searching algorithm. Finding the longest string which is equal to a substring of two or more strings is known as the longest common substring problem.

Example: The string ana is equal to substrings (and subsequences) of banana at two different offsets:

banana
|||
ana|
|
ana

In the mathematical literature, substrings are also called subwords (in America) or factors (in Europe).

Prefix

A prefix of a string T = t_1 dots t_n is a string widehat T = t_1 dots t_{m}, where m leq n. A "proper prefix" of a string is not equal to the string itself and not empty


Wikimedia Foundation. 2010.

Игры ⚽ Поможем написать реферат

Look at other dictionaries:

  • substring — noun A string of characters that is contained in another string, like ello in Hello . Precisely, a string A is a substring of B, if B = C . A . D for some strings C and D, where . is a concatenation operator, and C and D are possibly empty …   Wiktionary

  • Substring index — A substring index is a data structure which gives substring search in a text or text collection in sublinear time. If you have a document S of length n, or a set of documents D={S^1,S^2, dots, S^d} of total length n, you can locate all… …   Wikipedia

  • substring — n. contiguous portion of a string (Computers) …   English contemporary dictionary

  • substring — noun a string that is part of a longer string • Hypernyms: ↑string …   Useful english dictionary

  • Longest common substring problem — The longest common substring problem is to find the longest string (or strings) that is a substring (or are substrings) of two or more strings. It should not be confused with the longest common subsequence problem. (For an explanation of the… …   Wikipedia

  • Longest repeated substring problem — The longest repeated substring problem is finding the longest substring of a string that occurs at least twice. This problem can be solved in linear time and space by building a suffix tree for the string, and finding the deepest internal node in …   Wikipedia

  • Longest common substring — …   Википедия

  • Proto-Indo-European to Dacian sound changes — NOTE: all html boxes in this article need to be replaced by another format. The Dacian language was a Satem Indo European Language.hort vowelsPIE has the short vowels e, o. The existence of the PIE short vowel a is disputed.The origin of the Late …   Wikipedia

  • Comparison of programming languages (string functions) — String functions redirects here. For string functions in formal language theory, see String operations. Programming language comparisons General comparison Basic syntax Basic instructions Arrays …   Wikipedia

  • Vigesimal — The vigesimal or base num|20 numeral system is based on twenty (in the same way in which the ordinary decimal numeral system is based on ten). Places In a vigesimal place system, twenty individual numerals (or digit symbols) are used, ten more… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”