ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
Generation.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------*/
2/*--------------------------- File Generation.h ----------------------------*/
3/*--------------------------------------------------------------------------*/
58/*--------------------------------------------------------------------------*/
59/*----------------------------- DEFINITIONS --------------------------------*/
60/*--------------------------------------------------------------------------*/
61
62#ifndef __ADS_Generation
63 #define __ADS_Generation
64/* self-identification: #endif constant */
65
66/*--------------------------------------------------------------------------*/
67/*------------------------------ INCLUDES ----------------------------------*/
68/*--------------------------------------------------------------------------*/
69
70#include "ADS/Contract.h"
71
72#include <algorithm>
73#include <cstddef>
74#include <string>
75#include <type_traits>
76#include <utility>
77#include <vector>
78
79/*--------------------------------------------------------------------------*/
80/*--------------------------- NAMESPACE ------------------------------------*/
81/*--------------------------------------------------------------------------*/
82
83namespace ADS
84{
85
86using Tuple = std::vector< int >;
87
115template< class F >
116long mixedRadix( const std::vector< int > & m , F && visit );
117
141template< class F >
142long grayTuples( const std::vector< int > & m , F && visit );
143
166template< class F >
167long permutationsLex( Tuple a , F && visit );
168
199template< class F >
200long plainChanges( int n , F && visit );
201
224template< class F >
225long heapPermutations( int n , F && visit );
226
246template< class F >
247long combinationsLex( int n , int t , F && visit );
248
276template< class F >
277long revolvingDoor( int n , int t , F && visit );
278
314template< class F >
315long integerPartitions( int n , F && visit );
316
345template< class F >
346long setPartitions( int n , F && visit );
347
368template< class F >
369long nestedParentheses( int n , F && visit );
370
371/*--------------------------------------------------------------------------*/
372
373} // end( namespace ADS )
374
375/*--------------------------------------------------------------------------*/
376/*-------------------------- IMPLEMENTATION --------------------------------*/
377/*--------------------------------------------------------------------------*/
378
379#include "ADS/combinatorial/impl/Generation.tpp"
380
381/*--------------------------------------------------------------------------*/
382
383#endif /* Generation.h included */
384
385/*--------------------------------------------------------------------------*/
386/*------------------------- End File Generation.h --------------------------*/
387/*--------------------------------------------------------------------------*/
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
long combinationsLex(int n, int t, F &&visit)
the -combinations of as increasing tuples, in lexicographic order
long heapPermutations(int n, F &&visit)
the permutations of by Heap's method, one swap each
long mixedRadix(const std::vector< int > &m, F &&visit)
the tuples with , in lexicographic order, amortized per tuple after
long integerPartitions(int n, F &&visit)
the partitions of , their parts nonincreasing, in reverse lexicographic order, amortized per partiti...
long grayTuples(const std::vector< int > &m, F &&visit)
the tuples with in the reflected Gray order, loopless
long plainChanges(int n, F &&visit)
the permutations of by swaps of adjacent items, amortized per permutation, the same vector visited ...
long setPartitions(int n, F &&visit)
the restricted growth strings of the partitions of a set of items, in lexicographic order,...
long revolvingDoor(int n, int t, F &&visit)
the -combinations of in the revolving-door order
long nestedParentheses(int n, F &&visit)
the strings of pairs of balanced parentheses, in lexicographic order
long permutationsLex(Tuple a, F &&visit)
the permutations of the multiset , in lexicographic order from sorted
Definition ADT.h:96
std::vector< int > Tuple
a tuple, a permutation, a string
Definition Generation.h:86