ADS
Algorithms and Data Structures
Toggle main menu visibility
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
"
81
#include "
ADS/string/LongestCommonSubsequence.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
94
namespace
ADS
95
{
96
118
template
<
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
146
template
<
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
177
template
<
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
183
shortestCommonSupersequence
(
const
std::string & X ,
const
std::string & Y );
184
204
template
<
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
211
subsequenceOccurrences
(
const
std::string & P ,
const
std::string & T );
212
232
template
<
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
238
lcs3
(
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
/*--------------------------------------------------------------------------*/
Contract.h
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
LongestCommonSubsequence.h
The longest common subsequence (LCS) of and , the reality check of section 13.7 of the book: ,...
ADS::isInterleaving
bool isInterleaving(const S &X, const S &Y, const S &Z)
whether interleaves and keeping the order of the items of each
ADS::subsequenceOccurrences
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
ADS::lcs3
S lcs3(const S &X, const S &Y, const S &Z)
a longest common subsequence of , and
ADS::scsLength
std::size_t scsLength(const S &X, const S &Y)
the length of a shortest common supersequence of and
ADS::shortestCommonSupersequence
S shortestCommonSupersequence(const S &X, const S &Y)
a shortest common supersequence of and
ADS
Definition
ADT.h:96
ADS
string
SubsequenceProblems.h
Generated by
1.17.0