Saturday, May 22, 2010

Permutation Programming Challange! I dare you!!!?

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.)

Permutation Programming Challange! I dare you!!!?
Okay, so DON'T do your homework, I'm still not impressed with this little challenge that you have put forward basically as spam and a sort of backhanded, juvenile "Nyah, nyah" to others that may be newer and less skilled than yourself. On this board, we don't elect teachers to give out assignements and challenges, we try and help each other learn and solve problems. If you want to start a programming contest or challenge group, I bet Yahoo'd let you. Just not here, ok. Oh, yeah, *REPORTED*.

order flowers

No comments:

Post a Comment