Sign in to follow this  
xxx_shinobi

Algorithm for nPk permutations ?

Recommended Posts

xxx_shinobi    142
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
Fruny    1658
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
xxx_shinobi    142
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
Fruny    1658
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this