ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
string Directory Reference

Files

 
AhoCorasick.h
 The search of many patterns at once, beyond the book: the automaton of Aho and Corasick of a set of patterns \( P_0 , \ldots , P_{k-1} \) of \( M \) bytes in all finds all their occurrences in a text \( T \) of \( n \) bytes in one scan, \( O( n + \mathit{occ} ) \) time.
 
Alignment.h
 The alignments of two strings \( P \) and \( T \) of exercises 13.7 to 13.9 of the book: spaces are inserted in \( P \) or \( T \), never one in front of the other, and each column scores \( +1 \) if the characters are equal, \( -1 \) if they differ and \( -2 \) if one is a space.
 
Anagrams.h
 The classes of anagrams among \( n \) words of length at most \( k \): two words are anagrams if one is a permutation of the other.
 
ApproximateMatching.h
 The approximate string matching of section 13.1: an occurrence of the pattern \( P = p_0 \cdots p_{m-1} \) in the text \( T = t_0 \cdots t_{n-1} \) with \( k \) errors, each a substitution, an insertion (a character of \( P \) not in \( T \)) or a deletion (a character of \( T \) not in \( P \)).
 
EditDistance.h
 The engineered edit distance, longest common subsequence and approximate search, beyond the book: the ones that the benchmark of the distances compares with edlib and rapidfuzz-cpp, while editDistance(), stringMatching() [see ApproximateMatching.h] and lcs() [see LongestCommonSubsequence.h] stay the dynamic programming of the textbooks, \( \Theta( m n ) \) time.
 
FrontCoding.h
 The front coding of a sorted dictionary of strings, beyond the book: adjacent strings share a prefix, and frontCode() writes the string \( s_i \) as the pair \( ( \ell_i , \hat s_i ) \), \( \ell_i \) being the length of the longest common prefix of \( s_i \) and \( s_{i-1} \) (0 for the first one) and \( \hat s_i \) the rest of \( s_i \); frontDecode() copies \( \ell_i \) characters of the string before and appends \( \hat s_i \).
 
Huffman.h
 The code of Huffman (reality check of section 14.4): a prefix code, no code being a prefix of another one, so that a text can be decoded, of least length for the frequencies of the characters.
 
LongestCommonExtension.h
 The engineered longest common extensions of a text, beyond the book: the value \( \mathrm{lce}( i , j ) \) of the suffixes \( i \) and \( j \) of \( T \), the length of their longest common prefix, which the benchmark of the suffix arrays compares with the lce() of SuffixArray.h (the range minimum of Bender and Farach-Colton), with a range minimum of sdsl-lite and with the direct comparison of the two suffixes, while SuffixArray.h stays the textbook.
 
LongestCommonSubsequence.h
 The longest common subsequence (LCS) of \( P \) and \( T \), the reality check of section 13.7 of the book: \( \mathit{DP}[ i ][ j ] \), its length for the prefixes \( P( i ) \) and \( T( j ) \), is.
 
Lyndon.h
 The Lyndon factorization and the least rotation of a string, beyond the book.
 
MultiSearch.h
 The engineered search of many patterns at once, beyond the book: MultiSearcher finds all the occurrences in a text \( T \) of \( n \) bytes of \( k \) patterns \( P_0 , \ldots , P_{k-1} \): one pattern by StringSearcher [see StringSearch.h], up to 64 by a filter of shuffles of bytes, more by a filter of shift-or on super characters, and by the automaton of Aho and Corasick [see AhoCorasick.h] where a filter lets too much through; the benchmark of the multiple search compares it with AhoCorasick and with Vectorscan (the portable Hyperscan).
 
Palindromes.h
 Three classic problems on the palindromes of a sequence \( s \) of \( n \) items, and the eertree.
 
Parentheses.h
 The longest balanced strings of parentheses inside a text of \( n \) characters, where open and close are the two parentheses and every other character is neither.
 
PrefixSearch.h
 The search by prefix in a sorted dictionary of \( n \) strings, beyond the book: the strings prefixed by \( P \) are consecutive, between the lexicographic position of \( P \) (the number of strings smaller than \( P \)) and that of \( P\# \), \( \# \) being a character larger than all the others, so that two lexicographic searches give their range.
 
RearCoding.h
 The rear coding of a sorted dictionary of strings, beyond the book, and a compact dictionary on it (see Dictionaries searched by prefix): the front coding [see FrontCoding.h] writes the string \( s_i \) as the length \( \ell_i \) of the prefix it shares with \( s_{i-1} \) and the rest \( \hat s_i \); the rear coding writes instead \( r_i = | s_{i-1} | - \ell_i \), the characters to take off the end of \( s_{i-1} \) before appending \( \hat s_i \).
 
Segmentations.h
 The number of ways of writing a sequence \( X \) of \( n \) items as a concatenation of words, the counting version of the word break problem [see WordBreak.h, which finds one of them].
 
StringBreaking.h
 Breaking a string: a string of length \( L \) has to be cut at the places \( 0 < c_1 < \cdots < c_n < L \), and each cut costs the length of the piece it splits, so that the order of the cuts decides the total cost.
 
StringMatching.h
 The exact string matching, beyond the book: the occurrences of a pattern \( P \) of \( m \) characters in a text \( T \) of \( n \) characters, i.e., the places \( s \in [ 0 , n - m ] \) with \( T[ s .. s + m - 1 ] = P \).
 
StringSearch.h
 The exact search of a pattern \( P \) of \( m \) bytes in a text \( T \) of \( n \) bytes, beyond the book: the engineered search of ADS, the one that the benchmark of the searches compares with memmem() of the C library, std::search() with its three searchers and the searchers of Boost.Algorithm, while kmp() [see StringMatching.h] stays the algorithm of the textbook.
 
SubsequenceProblems.h
 Four classic problems on the subsequences of sequences \( X \), \( Y \), \( Z \) of lengths \( n \), \( m \), \( l \), relatives of the longest common subsequence [see LongestCommonSubsequence.h], each by dynamic programming on the prefixes.
 
SuffixApplications.h
 Problems on strings solved by a suffix array [see SuffixArray.h] or a suffix tree [see SuffixTree.h], beyond the book (those of chapter 10, Searching Strings by Substring, of Ferragina's book and their classical companions).
 
SuffixArray.h
 The suffix array of a text \( T \) of \( n \) symbols, beyond the book: \( \mathit{SA}[ r ] \) is the starting place of the \( r \)-th smallest suffix of \( T \) in the lexicographic order, a suffix that is a prefix of another being the smaller.
 
SuffixAutomaton.h
 The suffix automaton (the directed acyclic word graph, DAWG) of a string \( S \) of \( n \) bytes, beyond the book: the smallest deterministic automaton that accepts the suffixes of \( S \), whose paths from the start spell exactly the substrings of \( S \).
 
SuffixSorting.h
 The engineered construction of the suffix array and of its LCP array, beyond the book: the ones that the benchmark of the suffix arrays compares with libsais and libdivsufsort, while the constructions of SuffixArray.h stay those of the textbooks, on integers of the size of a pointer.
 
SuffixTree.h
 The suffix tree of a text \( T \) of \( n \) symbols, beyond the book: the compact trie [see RadixTree in Trie.h] of the \( n + 1 \) suffixes of \( T \$ \), where \( \$ \) is a terminator smaller than every symbol, so that no suffix is a prefix of another and each one ends in a leaf of its own.
 
WordBreak.h
 Is it Italian?