A word over an alphabet is a finite sequence of symbols from . The empty word has length zero, and denotes the set of all finite words.
A comparison of strings that disregards a chosen distinction between uppercase and lowercase characters. A simple convention compares characterwise lowercase forms. Full Unicode case folding is a distinct normalization operation and can change character counts.
The longest common prefix of two strings is the longest string that is a string prefix of both. Its length is the number of matching initial characters before the first mismatch or the end of a string. A direct scan maintains equality of the processed prefixes and takes time linear in that length plus one. For suffixes represented by indices in a shared array, no character copying is needed.
A string suffix consists of all characters from some position to the end of a string. For example, TAC has suffixes TAC, AC, C and the empty string. Sorting these in lexicographic order groups all suffixes beginning with a given query into one interval.
A cyclic rotation of a string is the string , where and are consecutive pieces. For example, rotating ABC left once gives BCA. A length- string has rotation positions, though repeated letters can make some resulting strings identical.
A substring is a contiguous segment of a string. It differs from a subsequence, whose selected characters need not be adjacent.
An infinite binary word is Sturmian if it has exactly distinct contiguous subwords of length for every positive integer .
A palindrome is a finite string equal to its reversal. For example, the strings and are palindromes.
Decide whether a finite string is a palindrome by comparing corresponding symbols from opposite ends. The test needs at most half as many symbol comparisons as the string length and can use constant auxiliary space.
Concatenation joins two strings end to end, retaining the order of their symbols. For example, joining and gives . It has the associative property: joining or gives the same word over an alphabet. The empty word is its identity element. All finite words over an alphabet with this binary operation form a free monoid.
The length of a word over an alphabet is the number of symbol positions in that finite string, counting repetitions. Thus and for the empty word. Concatenation satisfies . This differs from the word length of a group element, which minimizes over representing words using a chosen generating set of a group.
Articles by others on the same topic
There are currently no matching articles.