Sign in to follow this  

Algorithm for nPk permutations ?

This topic is 4260 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello. I really need some algorithm for finding all nPk permutations (ordered sub-sets with lenght = k) Number of such permutations is n!/(n-k)! Thanks in advance.

Share this post


Link to post
Share on other sites
If programming in C++, you can use the std::next_permutation and std::prev_permutation functions. The source code is available (in the <algorithm> header) in case you want to see the implementation (and thus the algorithm).

Share this post


Link to post
Share on other sites
Quote:
Original post by Fruny
If programming in C++, you can use the std::next_permutation and std::prev_permutation functions. The source code is available (in the <algorithm> header) in case you want to see the implementation (and thus the algorithm).



Is there something in .NET platform for nPk ?

Share this post


Link to post
Share on other sites
Quote:
Original post by xxx_shinobi
Is there something in .NET platform for nPk ?


I don't know. I doubt it. Check the documentation.

Share this post


Link to post
Share on other sites
Sign in to follow this