ADS
Algorithms and Data Structures
Toggle main menu visibility
Loading...
Searching...
No Matches
Enumeration.h
Go to the documentation of this file.
1
/*--------------------------------------------------------------------------*/
2
/*--------------------------- File Enumeration.h ---------------------------*/
3
/*--------------------------------------------------------------------------*/
39
/*--------------------------------------------------------------------------*/
40
/*----------------------------- DEFINITIONS --------------------------------*/
41
/*--------------------------------------------------------------------------*/
42
43
#ifndef __ADS_Enumeration
44
#define __ADS_Enumeration
45
/* self-identification: #endif constant */
46
47
/*--------------------------------------------------------------------------*/
48
/*------------------------------ INCLUDES ----------------------------------*/
49
/*--------------------------------------------------------------------------*/
50
51
#include <cstddef>
52
#include "
ADS/Contract.h
"
53
54
#include <algorithm>
55
#include <vector>
56
57
/*--------------------------------------------------------------------------*/
58
/*--------------------------- NAMESPACE ------------------------------------*/
59
/*--------------------------------------------------------------------------*/
60
61
namespace
ADS
62
{
63
84
template
<
class
F >
85
long
subsets
(
int
n ,
int
k , F && f );
86
87
namespace
detail
88
{
89
91
template
<
class
T ,
class
F >
92
long
permute(
const
std::vector< T > & A ,
bool
derange , F && f );
93
94
}
// end( namespace detail )
95
119
template
<
class
T ,
class
F >
120
long
permutations
(
const
std::vector< T > & A , F && f );
121
144
template
<
class
T ,
class
F >
145
long
derangements
(
const
std::vector< T > & A , F && f );
146
170
template
<
class
T ,
class
F >
171
long
subsetSum
(
const
std::vector< T > & A , T k , F && f );
172
173
/*--------------------------------------------------------------------------*/
174
175
}
// end( namespace ADS )
176
177
/*--------------------------------------------------------------------------*/
178
/*-------------------------- IMPLEMENTATION --------------------------------*/
179
/*--------------------------------------------------------------------------*/
180
181
#include "ADS/backtrack/impl/Enumeration.tpp"
182
183
/*--------------------------------------------------------------------------*/
184
185
#endif
/* Enumeration.h included */
186
187
/*--------------------------------------------------------------------------*/
188
/*------------------------- End File Enumeration.h -------------------------*/
189
/*--------------------------------------------------------------------------*/
Contract.h
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
ADS::subsetSum
long subsetSum(const std::vector< T > &A, T k, F &&f)
the subsets of the positive items of of sum , as the places taken, f( S ) on each and true from it t...
ADS::permutations
long permutations(const std::vector< T > &A, F &&f)
the permutations of the items of , f( S ) on each and true from it to stop; the items are told apart ...
ADS::subsets
long subsets(int n, int k, F &&f)
the subsets of of the items , as vectors of booleans, f( S ) on each and true from it to stop; the ...
ADS::derangements
long derangements(const std::vector< T > &A, F &&f)
the derangements of the items of , no item in its own place, f( S ) on each and true from it to stop;...
ADS
Definition
ADT.h:96
ADS
backtrack
Enumeration.h
Generated by
1.17.0