ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
SubsequenceProblems.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------*/
2/*----------------------- File SubsequenceProblems.h -----------------------*/
3/*--------------------------------------------------------------------------*/
68/*--------------------------------------------------------------------------*/
69/*----------------------------- DEFINITIONS --------------------------------*/
70/*--------------------------------------------------------------------------*/
71
72#ifndef __ADS_SubsequenceProblems
73 #define __ADS_SubsequenceProblems
74/* self-identification: #endif constant */
75
76/*--------------------------------------------------------------------------*/
77/*------------------------------ INCLUDES ----------------------------------*/
78/*--------------------------------------------------------------------------*/
79
80#include "ADS/Contract.h"
82
83#include <algorithm>
84#include <cstddef>
85#include <cstdint>
86#include <string>
87#include <type_traits>
88#include <vector>
89
90/*--------------------------------------------------------------------------*/
91/*--------------------------- NAMESPACE ------------------------------------*/
92/*--------------------------------------------------------------------------*/
93
94namespace ADS
95{
96
118template< class S >
119 requires std::is_class_v< S >
120[[nodiscard]] bool isInterleaving( const S & X , const S & Y , const S & Z );
121
123[[nodiscard]] inline bool isInterleaving( const std::string & X ,
124 const std::string & Y ,
125 const std::string & Z );
126
146template< class S >
147 requires std::is_class_v< S >
148[[nodiscard]] std::size_t scsLength( const S & X , const S & Y );
149
151[[nodiscard]] inline std::size_t scsLength( const std::string & X ,
152 const std::string & Y );
153
177template< class S >
178 requires std::is_class_v< S >
179[[nodiscard]] S shortestCommonSupersequence( const S & X , const S & Y );
180
182[[nodiscard]] inline std::string
183shortestCommonSupersequence( const std::string & X , const std::string & Y );
184
204template< class S >
205 requires std::is_class_v< S >
206[[nodiscard]] std::uint64_t subsequenceOccurrences( const S & P ,
207 const S & T );
208
210[[nodiscard]] inline std::uint64_t
211subsequenceOccurrences( const std::string & P , const std::string & T );
212
232template< class S >
233 requires std::is_class_v< S >
234[[nodiscard]] S lcs3( const S & X , const S & Y , const S & Z );
235
237[[nodiscard]] inline std::string
238lcs3( const std::string & X , const std::string & Y , const std::string & Z );
239
240/*--------------------------------------------------------------------------*/
241
242} // end( namespace ADS )
243
244/*--------------------------------------------------------------------------*/
245/*-------------------------- IMPLEMENTATION --------------------------------*/
246/*--------------------------------------------------------------------------*/
247
248#include "ADS/string/impl/SubsequenceProblems.tpp"
249
250/*--------------------------------------------------------------------------*/
251
252#endif /* SubsequenceProblems.h included */
253
254/*--------------------------------------------------------------------------*/
255/*--------------------- End File SubsequenceProblems.h ---------------------*/
256/*--------------------------------------------------------------------------*/
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
The longest common subsequence (LCS) of and , the reality check of section 13.7 of the book: ,...
bool isInterleaving(const S &X, const S &Y, const S &Z)
whether interleaves and keeping the order of the items of each
std::uint64_t subsequenceOccurrences(const S &P, const S &T)
the number of occurrences of as a subsequence of , modulo : 1 for the empty , 0 if is longer than
S lcs3(const S &X, const S &Y, const S &Z)
a longest common subsequence of , and
std::size_t scsLength(const S &X, const S &Y)
the length of a shortest common supersequence of and
S shortestCommonSupersequence(const S &X, const S &Y)
a shortest common supersequence of and
Definition ADT.h:96