TOPICS
Search

String


A string of length n on an alphabet l of m characters is an ordered arrangement of n not necessarily distinct symbols from l, where m and n are nonnegative integers. There are m^n such distinct strings for n>=1. There is one string of length 0, called the empty string or empty word, even when the alphabet is empty.

For example, the strings of length n=3 on the alphabet {1,2} are {1,1,1}, {1,1,2}, {1,2,1}, {1,2,2}, {2,1,1}, {2,1,2}, {2,2,1}, and {2,2,2}.

In the Wolfram Language, the corresponding sequences of length n over the alphabet consisting of the members of a list l can be enumerated as lists using Tuples[list, n].


See also

Alphabet, Ball Picking, Binomial Coefficient, Choose, Combination, Concatenation, Edit Distance, Hamming Distance, List, Multichoose, Multinomial Coefficient, Multiset, n-Tuple, Permutation, Shortest Common Superstring, Substring, Word

Explore with Wolfram|Alpha

References

Skiena, S. "Strings." §1.5.1 in Implementing Discrete Mathematics: Combinatorics and Graph Theory with Mathematica. Reading, MA: Addison-Wesley, p. 40, 1990.

Referenced on Wolfram|Alpha

String

Cite this as:

Weisstein, Eric W. "String." From MathWorld--A Wolfram Resource. https://mathworld.wolfram.com/String.html

Subject classifications