Algorithm for nPk permutations ?
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.
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).
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 ?
Quote:Original post by xxx_shinobi
Is there something in .NET platform for nPk ?
I don't know. I doubt it. Check the documentation.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement