|
ADS
Algorithms and Data Structures
|
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. More...
#include "ADS/Contract.h"#include "ADS/string/LongestCommonSubsequence.h"#include <algorithm>#include <cstddef>#include <cstdint>#include <string>#include <type_traits>#include <vector>#include "ADS/string/impl/SubsequenceProblems.tpp"Go to the source code of this file.
Namespaces | |
| namespace | ADS |
Functions | |
| template<class S> requires std::is_class_v< S > | |
| bool | ADS::isInterleaving (const S &X, const S &Y, const S &Z) |
| whether \( Z \) interleaves \( X \) and \( Y \) keeping the order of the items of each | |
| bool | ADS::isInterleaving (const std::string &X, const std::string &Y, const std::string &Z) |
| isInterleaving() above on std::string (or literals) | |
| template<class S> requires std::is_class_v< S > | |
| std::size_t | ADS::scsLength (const S &X, const S &Y) |
| the length of a shortest common supersequence of \( X \) and \( Y \) | |
| std::size_t | ADS::scsLength (const std::string &X, const std::string &Y) |
| scsLength() above on std::string (or literals) | |
| template<class S> requires std::is_class_v< S > | |
| S | ADS::shortestCommonSupersequence (const S &X, const S &Y) |
| a shortest common supersequence of \( X \) and \( Y \) | |
| std::string | ADS::shortestCommonSupersequence (const std::string &X, const std::string &Y) |
| shortestCommonSupersequence() above on std::string (or literals) | |
| template<class S> requires std::is_class_v< S > | |
| std::uint64_t | ADS::subsequenceOccurrences (const S &P, const S &T) |
| the number of occurrences of \( P \) as a subsequence of \( T \), modulo \( 2^{64} \): 1 for the empty \( P \), 0 if \( P \) is longer than \( T \) | |
| std::uint64_t | ADS::subsequenceOccurrences (const std::string &P, const std::string &T) |
| subsequenceOccurrences() above on std::string (or literals) | |
| template<class S> requires std::is_class_v< S > | |
| S | ADS::lcs3 (const S &X, const S &Y, const S &Z) |
| a longest common subsequence of \( X \), \( Y \) and \( Z \) | |
| std::string | ADS::lcs3 (const std::string &X, const std::string &Y, const std::string &Z) |
| lcs3() above on std::string (or literals) | |
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.
Each function takes any sequence S with size(), operator[], push_back() and the comparison of its items; the overloads on std::string also take string literals.
The contracts [see Contract.h]: the supersequence has \( X \) and \( Y \) as subsequences and the length of scsLength(), and lcs3() gives a subsequence of the three (audits). The functions are defined in SubsequenceProblems.tpp.