ADS
Algorithms and Data Structures
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
61namespace ADS
62{
63
84template< class F >
85long subsets( int n , int k , F && f );
86
87namespace detail
88{
89
91template< class T , class F >
92long permute( const std::vector< T > & A , bool derange , F && f );
93
94} // end( namespace detail )
95
119template< class T , class F >
120long permutations( const std::vector< T > & A , F && f );
121
144template< class T , class F >
145long derangements( const std::vector< T > & A , F && f );
146
170template< class T , class F >
171long 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/*--------------------------------------------------------------------------*/
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
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...
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 ...
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 ...
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;...
Definition ADT.h:96