I want a C/C++ program that will give the following out put)
The function will be
permutation(int *a, int n, int r)
the output will be a 2D array / pointer to an array that will consist a permutation of r elements chosen from the n elements of array a; (a has n elements)
the function's sample output will be like this:
code:
int a[4] = {1, 2, 3, 4};
permutation(a, 4, 4) results:
1234
1243
1324
1342
1423
1432
.......
4321
permutation (a, 4, 3) results:
123
132
231
213
312
321
412
...
etc
It is a challenging problem. Give me a complete C/C++ source code with example of implementation if you can.
(N.B. Any "Do your homework type answers will be flagged as abuse immediately.)
2006-12-04
02:02:10
·
1 answers
·
asked by
The Potter Boy
3
in
Programming & Design