22 int main(
int argc,
char **argv)
32 JParser<> zap(
"Example program to test permutations.");
40 catch(
const exception &error) {
41 FATAL(error.what() << endl);
50 if (N > buffer.size()) {
51 FATAL(
"Number of elements " << N <<
" > " << buffer.size() << endl);
54 sort(buffer.begin(), buffer.end(), less<int>());
68 DEBUG(
'[' << setw(3) <<
n <<
']');
71 DEBUG(
' ' << setw(3) << *i);
77 data.rbegin()->insert(*i);
83 DEBUG(
' ' << setw(3) << *i);
91 for (
vector<
set<int> >::const_iterator p = data.begin(); p != data.end(); ++p) {
92 for (
vector<
set<int> >::const_iterator q = p; ++q != data.end(); ) {
98 NOTICE(
"number of permutations " <<
n <<
' ' <<
factorial(buffer.size(), N) << endl);