unrank combination
Generates the combination of \e n objects out of \e m, of the given rank
Controller: CodeCogs
Interface
C++
Unrank Combination
std::vector<int>unrank_combination( | int | m | |
int | n | ||
int | rank | ) |
References:
SUBSET, a C++ library of combinatorial routines, http://www.csit.fsu.edu/~burkardt/cpp_src/subset/subset.htmlExample 1
#include <codecogs/maths/combinatorics/combinations/unrank_combination.h> #include <iostream> int main() { std::vector<int> comb = Maths::Combinatorics::Combinations::unrank_combination(6, 3, 10); std::cout << "Size of the combination: " << comb.size() << std::endl; for (int i = 0; i < comb.size(); i++) std::cout << comb[i] << " "; std::cout << std::endl; return 0; }
Output:Size of the combination: 3 1 5 6
Returns
- the combination with the given index
Authors
- Lucian Bentea (August 2005)
Source Code
Source code is available when you agree to a GP Licence or buy a Commercial Licence.
Not a member, then Register with CodeCogs. Already a Member, then Login.